On 2003-02-23, [EMAIL PROTECTED] wrote:

> > -----Original Message-----
> > From: Beni Cherniavsky
> > Sent: Sunday, February 23, 2003 2:02 PM
> > Subject: Re: Problem with Pth or make or what?
> >
> > Aside from security, it can also confuse scripts when you run
> > them in a
> > directory containing a program named the same as some system
> > program the
> > script uses.
>
> Rule #1 for script writing - never EVER relay on $PATH, better reset the
> path to a known value if you can and if you have the patience lookup
> individual command full paths at the beginning. I think there are
> already tools and standard "script libraries" to do that for you.
>
> Of course you are going to jump and say that scripts can't guess the
> right value for PATH, but that depends on the situation - if it's a
> global script then usually it should relay on globally available
> programs anyway. If it's something "local for the group" or something
> then even more so it can know which components should go in the path.
> Even if you are writing the script for your own private use I still
> recommand that you set the PATH because you never know what's going to
> be in it (e.g. scripts invoked via ssh and such or other situations
> where the "normal" path settings do not happen).
>
Good advice.  Indeed a quick grep of scripts in /usr/bin shows most reset
the path.  I was refering to my own ~/bin scripts and shell aliases where
I'm too lazy to do it.  Perhaps I'm wrong but PATH is intended to avoid
typing the full pathes, not to bring the need back.

On a second thought, having '.' in the *end* of the path is almost safe.
Not that I'd use it anyway, I'm typing dotslash automatically now :-).

-- 
Beni Cherniavsky <[EMAIL PROTECTED]>

The mind of a good coder knows what his computer would do for any of his
programs.  The computer of a good hacker knows what his mind would do if
it weren't for his programs.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to