bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inconsistent quote and escape handling in substitution part of param


From: Greg Wooledge
Subject: Re: Inconsistent quote and escape handling in substitution part of parameter expansions.
Date: Tue, 28 Feb 2012 11:18:40 -0500
User-agent: Mutt/1.4.2.3i

On Tue, Feb 28, 2012 at 05:10:40PM +0100, John Kearney wrote:
> so for the test case the goal is to take a string like
> kljlksdjflsd'jkjkljl
> wrap it with single quotes and globally replace all single quotes in the
> string with '\''

Is this an SQL thing?  Maybe you'd be better off using a language that
has an actual interface for database queries, including prepared
statements with variables and so on.

But if you insist:

imadev:~$ q=\'
imadev:~$ input="kljlksdjflsd'jkjkljl"
imadev:~$ echo "'${input//$q/$q\\$q$q}'"
'kljlksdjflsd'\''jkjkljl'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]