Jeff Abrahamson on Sat, 30 Nov 2002 17:10:05 -0500


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

Re: [PLUG] Variable interpolation in bash


On Sat, Nov 30, 2002 at 06:14:31AM -0500, Will Dyson wrote:
> Is there any way that I can simply include a litteral single quote 
> charecter in a single-quoted string in bash? I tried escapeing them with a 
> backslash, but that does not have the desired effect (as it would in perl).
> 
> 	FOO='bar \' #bash thinks the qouted string is over'

    jeff@diderot:jeff $ FOO='bar '"'"' #bash thinks the qouted string is over'
    jeff@diderot:jeff $ echo $FOO
    bar ' #bash thinks the qouted string is over
    jeff@diderot:jeff $ 

The mass of '"'"' is concatenation of adjacent string literals: a
single quoted string, a double quoted single quote, then another
single quoted string.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B

Attachment: pgpdqJKz7OJE1.pgp
Description: PGP signature