I need a bash command that will convert a string to something that is escaped. Here\'s an example:
echo \"hello\\world\" | escape | someprog
Pure Bash, use parameter substitution:
string="Hello\ world" echo ${string//\\/\\\\} | someprog