Re: safe way to set a path
On Tue, Aug 07, 2001 at 07:46:21AM +1000, Herbert Xu wrote:
> Wichert Akkerman <wichert@wiggy.net> wrote:
>
> > A better approach would be to set IFS to : and loop over the PATH entries
> > and see if one matches with the directory you want to add.
>
> The original message said that this is for a script. But why would you
> bother checking for this if it's just going to be used while the script
> is running? It doesn't hurt to have the same directory in the PATH twice.
This is just for a wrapper script which will be in /usr/bin, to change
PATH and a add a couple of env.vars and run something in /usr/lib.
Anyway, what I was looking for was Adam Heath's suggestion:
PATH="${PATH:+$PATH:}..."
Thanks to Steve Kowalik for digging it up and sending it to me.
Hamish
--
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>
Reply to: