Skip to main content
deleted 16 characters in body
Source Link
iruvar
  • 17k
  • 8
  • 51
  • 81

There is no need to use eval in this instance

eval $i forces eval to evaluate the contents of i as a command - this is why you see errors such as b: command not found being reported

A better way would be to print parameter values with bash using variable deferencing in this context would be

for i in a b c; do echo "$i=${!i}"; done
a=1
b=2
c=3

There is no need to use eval in this instance

eval $i forces eval to evaluate the contents of i as a command - this is why you see errors such as b: command not found being reported

A better way to print parameter values with bash using variable deferencing in this context would be

for i in a b c; do echo "$i=${!i}"; done
a=1
b=2
c=3

There is no need to use eval in this instance

eval $i forces eval to evaluate the contents of i as a command - this is why you see errors such as b: command not found being reported

A better way would be to print parameter values with bash using variable deferencing

for i in a b c; do echo "$i=${!i}"; done
a=1
b=2
c=3
added 136 characters in body
Source Link
iruvar
  • 17k
  • 8
  • 51
  • 81

There is no need to use eval in this instance

eval $i forces eval to evaluate the contents of i as a command - this is why you see errors such as b: command not found being reported

A better way to print parameter values with bash using variable deferencing in this context would be

for i in a b c; do echo "$i=${!i}"; done
a=1
b=2
c=3

There is no need to use eval in this instance

eval $i forces eval to evaluate the contents of i as a command - this is why you see errors such as b: command not found being reported

A better way to print parameter values with bash in this context would be

for i in a b c; do echo "$i=${!i}"; done
a=1
b=2
c=3

There is no need to use eval in this instance

eval $i forces eval to evaluate the contents of i as a command - this is why you see errors such as b: command not found being reported

A better way to print parameter values with bash using variable deferencing in this context would be

for i in a b c; do echo "$i=${!i}"; done
a=1
b=2
c=3
Source Link
iruvar
  • 17k
  • 8
  • 51
  • 81

There is no need to use eval in this instance

eval $i forces eval to evaluate the contents of i as a command - this is why you see errors such as b: command not found being reported

A better way to print parameter values with bash in this context would be

for i in a b c; do echo "$i=${!i}"; done
a=1
b=2
c=3