On 27/04/05, K. Shantanu <[EMAIL PROTECTED]> wrote:
> $ p=${PATH/\/usr\/lib\/courier-imap\/bin:/}
> $ echo $p
> /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/shantanu/bin
> 
> Ok?

Well, my sed's didn't need any escaping, and your snippet above will
not work when the directory you want to remove is at the end of the
PATH string.

The reason why this is not optimal (or why 3 sed -e's were required)
is that bash, when it encounters a : at the beginning or end of PATH,
or the sequence :: anywhere in between, assumes that you wanted .
(current directory) in your path and includes it for your convenience.
This can have unforeseen and at times unfortunate consequences.

You could, of course, have a sequence of substitutions - which is what
I did with sed.

Binand


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
linux-india-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to