Control: tags -1 moreinfo
On Tue, 24 Apr 2007 14:56:08 +0100 Tony Houghton <h...@realh.co.uk> wrote:
I want to add ${HOME}/bin to my PATH for non-interactive shells as well
as interactive ones. I tried to do this by adding:
ENV=/etc/home_path
BASH_ENV=/etc/home_path
Hi,
for the record, ENV/BASH_ENV are used only in non-interactive shells:
When bash is started non-interactively, to run a shell script, for
example, it looks for the variable BASH_ENV in the environment,
expands its value if it appears there, and uses the expanded value
as the name of a file to read and execute.
(From the bash man page)
to /etc/environment and creating /etc/home_path:
#!/bin/sh
if [ -d "${HOME}/bin" ] && echo $PATH | grep -qv "${HOME}/bin" ; then
export PATH="${PATH}:${HOME}/bin"
fi
The (BASH_)ENV variables are being set, and /etc/home_path is readable
and executable by everyone, but bash never runs it (confirmed by adding
extra diagnostics as well as setting PATH).
BASH_ENV seems to work fine in bash 5.2.21-2.
$ echo "echo BASH_ENV executed; FOOBAR=baz" > /tmp/env
$ export FOOBAR=eee; BASH_ENV=/tmp/env bash -c 'echo $FOOBAR'
BASH_ENV executed
baz
/etc/environment is read only if the pam_env module is loaded. Maybe in
your system pam_env is not being loaded?
Regards,
--
Gioele Barabucci