users and scripts

Bill Maltby - LFS Related lfsbill at
Thu Oct 24 13:47:03 PDT 2002

On Thu, 24 Oct 2002, Eric Miller wrote:
>I am doing my 4.0 install partially scripted.  I am wondering, if an install
>script is run as user lfs or root or whatever, does the script run as that
>user, or as a system uid?

Without extra effort, scripts run as the user that invoked them.


>This may sound like a silly question, but here is the root of it:  I have
>all of chapter 5 completely scripted, and it runs flawlessly.  The script
>declares LFS=/mnt/lfs and some other env variables that are useful (e.g.
>src=/$LFS/static/src/), and the script itself uses these to install all of
>Chapter 5 without error.  However, when the script is finished, and is
>kicked back out to the prompt, if I echo $LFS or $src, I get nothing?  Yes,
>I have two seperate scripts, one for pre su - lfs and one for post su -lfs.
>Both scripts declare both values at the beginning and run perfectly.

man bash! In there you will be able to see that variables set inside a
lower lever shell are not exported to the calling shell. There are a few
ways around this. But not seeing your scripts, I will not suggest one of
the methods because there could be endesired side-effects.

man bash!
>Is there a difference between 'LFS=/mnt/lfs' and 'export LFS=/mnt/lfs'?  I
>have tried it both ways and still get nothing when I echo either $value
>after the script has finished successfully.

Yes, there is a difference. However, environments are exported *downward*,
not "upward", so the effect in your particular case is identical regarding
what you apparently expected to see.

Bill Maltby
billm at

Unsubscribe: send email to listar at
and put 'unsubscribe lfs-support' in the subject header of the message

More information about the lfs-support mailing list