On Wednesday, August 3, 2022 at 11:49:42 PM UTC+8, Keith Thompson wrote:
> Bit Twister <
BitTw...@mouse-potato.com> writes:
> > On Tue, 2 Aug 2022 22:22:46 -0700 (PDT),
hongy...@gmail.com wrote:
> >> I set the environment variables as follows for my customized script/program/tool as follows:
> >>
> >> script_realdirname=/path/to/some/script
> >> export ISODATA=$script_realdirname/iso/
> >> export PATH=$ISODATA:$PATH
> >>
> >> If I combine the above last two lines into the following, the PATH export does not seem to take effect:
> >>
> >> export ISODATA=$script_realdirname/iso/ PATH=$ISODATA:$PATH
> >>
> >> Any hints for this problem?
> >
> > Not me since it appears to work for me.
> >
> > [bittwister@wb ~]$ script_realdirname=/path/to/some/script
> > [bittwister@wb ~]$ export ISODATA=$script_realdirname/iso/
> > [bittwister@wb ~]$ export PATH=$ISODATA:$PATH
> > [bittwister@wb ~]$ export ISODATA=$script_realdirname/iso/ PATH=$ISODATA:$PATH
> > [bittwister@wb ~]$ echo $PATH
> > /path/to/some/script/iso/:/path/to/some/script/iso/:/home/bittwister/local/work:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/lib64/qt5/bin:/usr/lib64/qt4/bin:/local/bin:/usr/local/games:/usr/games:/home/bittwister/local/bin:/local/bin
> It works for you because you *added* the double export command after
> executing the export ISODATA=... and export PATH=... commands.
>
> If you *replace* the two export commands with a single one, then of
> course the ISODATA hasn't been set yet, and '$ISODATA' doesn't expand.
>
> $ export ZERO=ONE TWO=$ZERO
> bash: ZERO: unbound variable
> $