|
From: | Peng Yu |
Subject: | Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted? |
Date: | Wed, 25 Mar 2015 15:57:39 -0500 |
> printf -v escaped_var %q "$var" I don't see this usage in the manual. > shquote() { > local q=\' > printf "'%s'" "${1//"$q"/$q\\$q$q}" > } > escaped_var=$(shquote "$var") This is not robust with other characters that need to be escaped. -- Regards, Peng
[Prev in Thread] | Current Thread | [Next in Thread] |