I am facing a problem related to the shell change , when i change shell from bash to csh
and type the comand echo $SHELL
i except to have
but the result is
what is the reson for that , and how to solve it
$SHELL is only a variable. If you want to use it, you have to set it to the current shell.
For me works the following command. You get the current shell:
ps -p $$ -o cmd | tail -n1
-p $$ list only the process id of the current process. In this case the shell.
-o cmd return only the row cmd
the tail is to hide the header.
Or the advanced version, if i want the complete shell binary path:
which `ps -p $$ -o cmd | tail -n1 | sed s/-//g`