export which is correct syntax
Suvayu Ali
fatkasuvayu+linux at gmail.com
Sat Jan 4 16:09:42 UTC 2014
On Sat, Jan 04, 2014 at 03:51:02PM +0000, Dave Mitchell wrote:
> 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.
Oops! Not sure where my mind is today; you are right. I was thinking
the *new* value is in TMPDIR for some inexplicable reason!
--
Suvayu
Open source is the future. It sets us free.
More information about the users
mailing list