How to escape special characters in a Bash string in Linux?

The problem is with ssh that makes a quoted string to more than one if there are spaces. For example,

ssh user@host cmd "my string"

The cmd on host will be executed like

cmd my string

rather than

cmd "my string"

It will only work if the string is escaped like

ssh user@host cmd my\ string

Space is one example, there are many more other special characters in Bash.

The question is how to escape special characters in a Bash string in Linux nicely and easily?

asked Jan 15 by anonymous

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...