On Sun, 2 Apr 2006 17:31:33 +1000
Peter Chubb <[EMAIL PROTECTED]> wrote:

> >>>>> "Simon" == Simon Bowden <[EMAIL PROTECTED]> writes:
> 
> Simon> On Fri, 31 Mar 2006, Steven Heimann wrote:
> >> **1. Scope**
> >> 
> >> I wrote the following
> >> 
> >> sed -i.bak "s/^\(\*\*[0-9][. ]\)\*\*\(.*\)$/\1\2**/" *.txt
> 
> The $ will be interpreted by the shell, because it's in double
> quotes.  Depending on what shell you're using the backslashes could
> also be swallowed.  You need to use single quotes for most shells. 

I know this might be off topic a bit but...  I would definitely say it depends
on your shell as to whether or not the "$" will be interpreted.

My bash shell doesn't expand this out.
[EMAIL PROTECTED] echo $0
-bash
[EMAIL PROTECTED] num="something to do here is a dollar sign at the end"
[EMAIL PROTECTED] echo $num | sed -s "s/end$/start/"
something to do here is a dollar sign at the start
[EMAIL PROTECTED] $

Neither does ksh.
[EMAIL PROTECTED] exec ksh
$ num="something to do here is a dollar sign at the end"
$ echo $num | sed -s "s/end$/start/"
something to do here is a dollar sign at the start
$

Of course zsh is no different either.
$ exec zsh
host% num="something to do here is a dollar sign at the end"
host% echo $num | sed -s "s/end$/start/"
something to do here is a dollar sign at the start

You must be using an odd shell as I found that ash as well didn't expand it
either.

unauthorized-
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to