shell scripting advise: Don't use backslashes inside backtick quotes

Oswald Buddenhagen ossi at kde.org
Thu Aug 4 05:31:42 UTC 2005


On Thu, Aug 04, 2005 at 01:19:50AM +0200, Roland Illig wrote:
> quote() {
> 	_sedexpr="s,','\\\\'',g"
>         _quotestr=`echo x"$1" | sed -e '1s,^x,,' -e "${_sedexpr}"`
>         echo "'${_quotestr}'"
> }
> 
> So if you ever use backticks, please don't use backslashes inside them.
> 
yes, it's a well-known ;) fact that backticks have weird semantics when
it comes to about any other nested quoting.
really old shells will explode on your current version, too, but we
really needn't to consider those.

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.



More information about the mc-devel mailing list