Welcome to the Linux Foundation Forum!

echo $SHELL

Dear All,

 

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

/bin/csh

but the result is

/bin/bash

what is the reson for that , and how to solve it

Thanks all

 

Comments

  • morksmorks Posts: 3

    Hi,

    $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`

    Br

    morks

Sign In or Register to comment.