You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Joachim Ansorg edited this page Nov 12, 2021
·
4 revisions
This is a literal string. To run as a command, use $(..) instead of '..' .
Problematic code:
foriin'seq 1 10'doecho"$i"done
Correct code:
foriin$(seq 1 10)doecho"$i"done
Rationale:
The intent was to run the code in the single quotes. This would have worked with slanted backticks, `..`, but here the very similar looking single quotes '..' were used, resulting in a string literal instead of command output.
This is one of the many problems with backticks, so it's better to use $(..) to expand commands.