Re: bad case of parameter substitution with quotes (${p//x/y})
From:
Greg Wooledge
Subject:
Re: bad case of parameter substitution with quotes (${p//x/y})
Date:
Wed, 23 Jun 2010 16:39:04 -0400
User-agent:
Mutt/1.4.2.3i
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.