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

  • 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:


    1. 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:


    1. which `ps -p $$ -o cmd | tail -n1 | sed s/-//g`

    Br

    morks

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training