Walt Mankowski on 23 Aug 2009 19:47:56 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] the character least likely to find in a Unix file name


On Sun, Aug 23, 2009 at 10:11:01PM -0400, TuskenTower wrote:
> One more question on this.  Which code pattern would you prefer for
> modifying $PATH?  We have an env var that is in $PATH and we are
> replacing it with a new one.  That is why the sed command is built
> using double quotation marks and have dollar-variables in them.
> 
>   PATH=`echo $PATH | sed "s"'$'"$old_phat"'$'"$new_path"'$'`
> 
> OR
> 
>   PATH=`echo $PATH | sed "s;$old_path;$new_path;"`

I guess I probably could have been more explicit in my original post,
but the reason I suggested using perl instead of awk was that with
perl you can pass in old_path and new_path as command-line parameters
and avoid these quoting issues.

Walt

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug