[Gllug] simple bash problem

Richard Cohen richard at vmlinuz.org
Wed Jan 23 19:56:26 UTC 2002


On 23 Jan 2002, mike wrote:

> anyone got any idea why this is not working
>
> #!/bin/bash -v
> export PATH='/usr/local/gnome/bin:$PATH'
> export LD_LIBRARY_PATH=$'/usr/local/gnome/lib:$LD_LIBRARY_PATH'
> export GNOME_PATH=$'/usr/local/gnome'
> export PKG_CONFIG_PATH=$'/usr/local/gnome/lib/pkgconfig:/usr/lib'
> export USE_GNOME_2_MACROS=1
>
> or this
>
> #!/bin/bash
> PATH=/usr/local/gnome/bin:$PATH
> export PATH
> LD_LIBRARY_PATH=/usr/local/gnome/lib/:$LD_LIBRARY_PATH
> export LD_LIBRARY_PATH
> GNOME_PATH=/usr/local/gnome/
> export GNOME_PATH
> PKG_CONFIG_PATH=/usr/local/gnome/lib/pkgconfig/:/usr/lib
> export PKG_CONFIG_PATH
> USE_GNOME_2_MACROS="1"
> export USE_GNOME_2_MACROS
>
> both run without error but dont do anything apart from set
> USEER=Mike=_./programname

You can't set the environment for your parent process.  When you run these
scripts, they run in a subshell, and change the environment in that
subshell, when then closes, dumping the environment changes.

If you . in the script rather than running it straight out, it'll affect
your current shell.  Like this:
. ./script.sh
rather than
./script.sh

Cheers
Richard


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list