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 Jul 5, 2024
·
6 revisions
This word is outside of quotes. Did you intend to 'nest '"'single quotes'"' instead?
Problematic code:
alias server_uptime='ssh $host 'uptime -p''
Correct code:
alias server_uptime='ssh $host '"'uptime -p'"
Rationale:
In the first case, the user has four single quotes on a line, wishfully hoping that the shell will match them up as outer quotes around a string with literal single quotes:
Which is the same thing as alias server_uptime='ssh $host uptime' -p.
There is no way to nest single quotes. However, single quotes can be placed literally in double quotes, so we can instead concatenate a single quoted string and a double quoted string: