Hacker News new | ask | show | jobs
by nneonneo 1064 days ago
If you do need single quotes in the inner command, you can use the "'" trick:

    ssh host -- ls "'"'folder$name'"'"
1 comments

$name will never be expanded. Is that what you expected?
Yes, that’s the intent: using single quotes at both levels will prevent either your shell or the remote shell from expanding the name, so you can interact with a file name containing a literal $.