[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash command completion



On 7 July 2016 at 08:06, Lisi Reisz <lisi.reisz@gmail.com> wrote:
>
> So have you followed the suggestion to test whether it is in fact bash that
> you are in fact using?
>
> lisi@Tux-II:~$ echo $SHELL
> /bin/bash
> lisi@Tux-II:~$

In case anyone is unaware, it might be generally helpful to clarify what
this test actually does.

Here's a demo on my system:
# my login shell is bash:
[david@kablamm]$ echo $SHELL
/bin/bash
# now I run dash
[david@kablamm]$ dash
# now repeat the above test, inside dash:
$ echo $SHELL
/bin/bash
$
# and now I type ^D to return to the login bash
[david@kablamm]$

Which demonstrates that $SHELL does not report the running shell.
It reports the user's login shell. Which might be different to whatever
shell the echo command happens to be typed into.

$SHELL is not controlled by the running shell. It is supplied to it in
its runtime environment.

$SHELL is set by 'login' process and exported to child processes.
It is set to the value specified in /etc/passwd. This is mentioned
in 'man 1 login'.

Many shells are not capable of identifying themselves directly.
bash can do it like this:
[david@kablamm]$ echo $BASH_VERSION
Neither sh nor dash have this capability.


Reply to: