On Sat, Jan 04, 2014 at 04:08:17PM +0100, Suvayu Ali wrote:
On Sat, Jan 04, 2014 at 10:37:48PM +1030, Tim wrote:
> Frank Murphy:
> > > 1: export TMPDIR=/var/tmp
> > > 2: export TMPDIR=$TMPDIR:/var/tmp
>
> Suvayu Ali:
> > Depends on what you want to do. If you want to overwrite the variable,
> > use (1). If you want to add (prepend) to the variable, use (2).
>
> Wouldn't that actually be an append - add onto the end of the existing
> variables, as opposed to insert before the existing variables (prepend).
This would be append:
3: export TMPDIR=/var/tmp:$TMPDIR
This is how I understand it; if a matching path is found, it is
considered for the task at hand. So prepend (front) would mean "I want
this to be considered before everything else", whereas append (back)
would mean "I want this to be considered when everything else fails".
The easiest example to see it in action is the PATH variable.
Does that make sense?
No.
TMPDIR=/tmp
..
export TMPDIR=/var/tmp:$TMPDIR
TMPDIR now contains /var/tmp:/tmp and the new path (/var/tmp) is earlier
in the search than the existing value(s) and will be used in preference to
/tmp. So /var/tmp has been *pre*pended to the search path by any
definition I can think of.
--
"Strange women lying in ponds distributing swords is no basis for a system
of government. Supreme executive power derives from a mandate from the
masses, not from some farcical aquatic ceremony."
-- Dennis, "Monty Python and the Holy Grail"