[H-GEN] regular expressions

James McPherson at home James.McPherson at aus.sun.com
Mon Aug 21 04:36:25 EDT 2000


[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics.  Please observe the list's charter.          ]

Bruce-the-Bofh wrote
> 
> On Mon, 21 Aug 2000, Martin Pool wrote:
> mbp> On Sat, Aug 19, 2000 at 09:10:36AM +1000, Jason Henry Parker wrote:
> mbp> 
> mbp> > I always trap my sed expressions in forward-quotes to hide them
> mbp> > completely from the shell.  [ObPeeve:  forward quotes cannot be
> mbp> > escaped from bash _at all_.]
> mbp> 
> mbp> Perhaps I misunderstand you, but
> mbp> 
> mbp>   $ echo I think jason\'s wrong
> 
> $ echo No matter which quotes you use, whether \"double\", \'single\' \
>   in either \`direction\`, they can all be \\escaped under bash\(1\) . \
>   And you can "do this inside \"another\" string like \'this\' ".
> 

obpedant: commas and {full stops}/periods should appear _inside_ the quotes, 
whether single or double.

obksh: the echo above under ksh in solaris gives this (lines wrapped for your 
viewing pleasure):

No matter which quotes you use, whether "double", 'single' in either 
`direction`, they can all be \escaped under bash(1) . And you can do this 
inside "another" string like \'this\' .

so to some extent ksh is not quite as quotation-aware as one might hope. Bourne 
shell gives this too:

No matter which quotes you use, whether "double", 'single' in either 
`direction`, they can all be \escaped under bash(1) . And you can do this inside 
"another" string like \'this\' .


whereas bash 2.02 on bipedal (solaris 7) gives:

which bash
/usr/local/bin/bash
$ bash
bash-2.02$ echo No matter which quotes you use, whether \"double\", \'single\' \
>   in either \`direction\`, they can all be \\escaped under bash\(1\) . \
>   And you can "do this inside \"another\" string like \'this\' ".
No matter which quotes you use, whether "double", 'single' in either 
`direction`, they can all be \escaped under bash(1) . And you can do this inside 
"another" string like \'this\' .


ain't life grand when it's a slow day!

James


--
Solution Centre Engineer              828 Pacific Highway 
Sun Microsystems Australia Pty Ltd    Gordon NSW 2072
             Support Helpline: 1-800-555-786




--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.



More information about the General mailing list