AWK/shell quoting (was: Re: Access to UNIX-Related Publications)
    brnstnd at stealth.acf.nyu.edu 
    brnstnd at stealth.acf.nyu.edu
       
    Mon Jan  8 09:04:43 AEST 1990
    
    
  
In article <2367 at leah.Albany.Edu> emb978 at leah.Albany.EDU.UUCP (Eric M. Boehm) writes:
> awk 'BEGIN { print "\'" }'
The shell will parse that line into the following chunks:
  awk 'BEGIN { print "\'" }'
  ^^^                   ^^^^ and we're missing a " here.
      ^^^^^^^^^^^^^^^^^^ this is all single-quoted
The backslash doesn't affect the quote because nothing inside single
quotes is interpreted (except history references). 'he\'s' is parsed as
the string he\, followed by s, followed by an unmatched single quote.
Instead of \' you want to escape from single quoting: '\''.
---Dan
    
    
More information about the Comp.unix.wizards
mailing list