On Wed, Jun 23, 2010 at 10:54:50AM +0200, Yves wrote: > I want to generate a "bash-proof" string by enclosing it in > single quotes and managing enclosed single quotes.
A better approach is to use: printf -v new_string %q "$original_string" printf %q is essentially the reverse of eval.