Hi, Suppose that I have a verbatim string " a b c ( a'b | " in bash, and I want to pass them as 6 command line arguments. I have to the following conversion using quoteverb.sed to pass the 6 arguments correctly to echo, which is a little bit cumbersome. I'm wondering if there is any better way to pass the 6 arguments.
~$ cat quoteverb.sed 1s/^\s+//g s/^\s\+//g s/\s\+$//g s/\s\+/\n/g s/'/'\\''/g s/^/'/gm s/$/'/gm s/\n/ /g ~$ cat main.sh #!/usr/bin/env bash verbatim_string=" a b c ( a'b | " args="`echo \"$verbatim_string\" | sed -f quoteverb.sed`" cmd="echo $args" eval "$cmd" ~$ ./main.sh a b c ( a'b | -- Regards, Peng