OK, here is the whole snippet and what it appears to be doing. I still don't know how:
quoted_args () { for arg in "$@"; do esc=`echo "$arg" | sed "s/'/'\\\\\\\\''/g"` printf " '%s'" "$esc" done printf ' ;\n' }
cmd () { quoted_args "$@" }
Then you can something like this:
cmd echo this is crazy
and it outputs this:
'echo' 'this' 'is' 'crazy' ;
Another script takes this output and then does the actual echo (or whatever command it is you use). Useful for what we are doing, but I'm still baffled by the sed command. Can anyone explain further?
Thanks,
Bryan
Try running it on a string with apostrophes in it, e.g.
cmd congrats it's a boy
____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
