[NCLUG] /etc/environment

Bob Proulx bob at proulx.com
Sun Aug 19 13:54:03 MDT 2007


John L. Bass wrote:
> Bob Proulx writes:
> > You meant 'expr' in the above, right?
> >   a=`expr $a + 1`
> > :-)
> 
> yep ... said that last night :)

Sorry, I did not hear you until just now. :-)

> > Note that in today's modern shells I would recommend doing math
> > directly in $((...)) expressions.  It is POSIX standard and all
> > standard shells support it.
> >   a=$(( $a + 1 ))
> > [This does not apply to /etc/environment though.]
> 
> Which I consider a gross bug, including the original problem with
> previously defined variable evaluations not supported.

For all of the reasons I just now mentioned in the other message the
/etc/environment is a hack and one that is still mutating from year to
year.  First it was an IBM AIX specific hack.  Then PAM picked it up.
Then people complained that system processes started out of
/etc/init.d/* (non-pam started processes) did not get that
configuration and so more twiddling happens.  It has not yet matured
in the GNU/Linux distros.  Traditional Unix systems handle it
differently.  I recommend avoiding it for other than distro specific
configuration, for which it would be known to work with that distro.
There are snags for the unwary.

Bob



More information about the NCLUG mailing list