> flist=`echo "$flist" | sed -e 's/\ '$fn'\ / /' `

Thanks.  That works with one additional modification - instead of…

flist="abcde bc de"

…if I use…

flist=". abcde bc de ."

…then it works!  The premise for my script is that the current directory (.)
will never be in my file list, so $fn will never be = ".".

Some rules about bash (and perhaps other shell) variables I've learned here
are:

1) Leading spaces in a variable are eaten, e.g. var="  abc" becomes "abc"
2) Same for trailing spaces, e.g. var="abc  " becomes "abc"
3) Multiple spaces between words are reduced to a single space, e.g. var="a
b   c" becomes "a b c"

Are there any docs that spell the above out, including an explanation as to
why it works that way?  I've read lost (er, lots, although 'lost' is often
appropriate:) of man pages and HowTo's but haven't seen this mentioned
anywhere.

Thanks again!

bd



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Luke C Gavel
Sent: Wednesday, January 03, 2001 12:22 AM
To: Brad Doster
Cc: [EMAIL PROTECTED]
Subject: Re: Whole word substitution with sed


On Tue, 2 Jan 2001 [EMAIL PROTECTED] wrote:

> flist=`echo "$flist" | sed -e 's/'$fn'//' | awk '{ print }'`
>


(untested)

  flist=`echo "$flist" | sed -e 's/\ '$fn'\ / /' `
                                             ^
                                             |
                                          [space]

-- Generated Signature --
Most general statements are false,
including this one.
                -- Alexander Dumas
-- End Sig --



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to