bug-bash
[Top][All Lists]
Advanced

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

Re: BASH bug CDPATH plus redirection


From: Tim Mooney
Subject: Re: BASH bug CDPATH plus redirection
Date: 28 Jun 2001 19:49:51 GMT

In article <address@hidden>,
Paul Jarc <address@hidden> wrote:
> address@hidden (Tim Mooney) writes:
> > The reason is that modern shells honor ENV, and will happily read
> > what ENV points to when starting a script or subshell.
> 
> The bash man page (confirmed by experiment) says that ENV is used for
> interactive shells invoked as "sh".  BASH_ENV is used for
> non-interactive shells not invoked as "sh".

I'm not limiting the trouble to bash:

02:43pm dogbert mooney$echo 'export FOO=bar' > /tmp/bashrc
02:44pm dogbert mooney$export ENV=/tmp/bashrc
02:44pm dogbert mooney$cat > some-script   
#!/usr/bin/ksh

echo 'hi there'
echo $FOO
^D
02:44pm dogbert mooney$chmod 555 some-script 
02:45pm dogbert mooney$./some-script 
hi there
bar




To state again: modern shells (including ksh, the POSIX shell, which *is*
/bin/sh on many machines, and bash itself) will read what ENV points to.
That means that setting CDPATH in your environment file and then pointing
ENV to it will cause shell scripts run by several different sh-ish shells
to get that setting.  This is what I was trying to avoid when I suggested
keeping CDPATH in your .profile, and it's what I was trying to explain
in the post you responded to.

Tim
-- 
Tim Mooney                              address@hidden
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164



reply via email to

[Prev in Thread] Current Thread [Next in Thread]