I need a bash command that will convert a string to something that is escaped. Here\'s an example:
echo \"hello\\world\" | escape | someprog
In Bash:
printf "%q" "hello\world" | someprog
for example:
printf "%q" "hello\world" hello\\world
This could be used through variables too:
printf -v var "%q\n" "hello\world" echo "$var" hello\\world