When I send a command to a remote server over ssh what is the difference between:
ssh user@123.456.789.012 'foo'
and
ssh user@123.456.789.012 "foo"
I am not passing any variables, and I am getting different results when running a command remotely.
Best Answer
Probably no difference for that example but there certainly would be for this one:
The reason is that bash will evaluate and substitute variables inside double-quotes on the local machine but will do it on the target machine inside single quotes.
The same is true for subshells:
However, it appears to not be true for functions:
Globbing also does not happen within double quotes: