I would like to know the exact difference between $0 and $SHELL. I know that these two are used to know the shell info.
It would be great if some one explain with examples.
What does it indicate if both show different values as below ?
# echo $0
ksh
# echo $SHELL
/sbin/sh
#
SHELLis just an environment variable, while$0is the path of the currently running program. The user should setSHELLto the value of the preferred shell, similar to the way the user setsPAGERandEDITOR. Any program that needs to spawn a shell should check the value ofSHELLto determine which shell to invoke.SHELLis not the path of the shell you get when you login. It will not change when a new shell is run any more thanPAGERwill change if it is set tolessbut the user invokesmore, or ifEDITORis set toviand the user runsemacs. For instance: