Command to escape a string in bash

Posted by User1 on Stack Overflow See other posts from Stack Overflow or by User1
Published on 2010-05-18T04:58:00Z Indexed on 2010/05/18 5:00 UTC
Read the original article Hit count: 273

Filed under:
|

I need a bash command that will convert a string to something that is escaped. Here's an example:

echo "hello\world"|escape|someprog

Where the escape command makes "hello\world" into "hello\\world". Then, someprog can use "hello\world" as it expects. Of course, this is a simplified example of what I will really be doing.

© Stack Overflow or respective owner

Related posts about bash

Related posts about escape