Date: Sun, 05 Jun 2016 12:52:34 -0500 From: Brandon J. Wandersee <brandon.wandersee@gmail.com> To: Baho Utot <baho-utot@columbus.rr.com> Cc: freebsd-questions@freebsd.org Subject: Re: sh[it] and What am I missing here? Message-ID: <86h9d7r09p.fsf@WorkBox.Home> In-Reply-To: <6f157455-0bda-ef46-82dc-e97fb0c4a08b@columbus.rr.com> References: <57544c10.90e58c0a.cacbc.62fd@mx.google.com> <cdf04501-79ef-9dbb-14f0-ed10a6d7241e@columbus.rr.com> <57545029.5060805@gmail.com> <6f157455-0bda-ef46-82dc-e97fb0c4a08b@columbus.rr.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Baho Utot writes: > So here is what I tried. > Power on console ( boot computer ) > Login in as root > /bin/sh > > set # to show environment etc > WTF SHELL says I am in csh???? > > It should say SHELL=/bin/sh > > Hence my question here as to what is going on. It seems the $SHELL variable is derived from the settings for the account you log into. That variable persists when you run another shell, as (a) the base environment is inherited by child processes; and (b) the (interactive) shell is just another running user program at that point, not a base working environment itself. Log in as root and start a different (interactive) shell, and the variable will remain unchanged. Log in as a normal user and start another shell, and you'll get the same result. Log in as any user and `su` to any other user---simulating a new login---and the value of the variable will change to the user shell for the new account. As I understand it, you can have a script you've executed change the variable having it simulate a login shell and parse a custom configuration file. See the "Invocation" section of the sh(8) man page for an explanation. -- :: Brandon J. Wandersee :: brandon.wandersee@gmail.com :: -------------------------------------------------- :: 'The best design is as little design as possible.' :: --- Dieter Rams ----------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86h9d7r09p.fsf>