escaping - Command to escape a string in bash -


I need a bash command that will change a string in some part. Here's an example:

 "Hello \ world" echo. Escape | Someprog 

Whereas the escape order "hello \ world" makes hello in the \ "world \" thereafter, some people can use "hello \ world" as it is expected, of course Actually I'm a simple example of what I'm doing.

In Bash:

  printf "% q" "Hello \ World "| | For some example:  

For example:

  printf "% q" "hello \ world" hello \\ world  

It can also be used through variables:

  printf -v var "% q \ n" "Hello \ world" echo "$ var" Hello \\ world  

Comments