0

I have a shell on a Unix system.

Is there a command that can tell me which shell I am working ? (bash, zsh, etc. )

2
  • I am rushed to post an answer. Have a look here Commented Dec 27, 2022 at 7:16
  • 1
    An extensive solution was given to question several years ago. It was designed for shell scripts but can be put into a function for interactive shells. Commented Dec 27, 2022 at 13:59

1 Answer 1

2

You can use environment variables to get the current shell and the shell for the user that is logged in!

echo $0 - Displays the shell that is currently in use.

echo $SHELL - Displays the shell for the user currently logged in.

NOTE: You can use the printenv command to look at all the env variables

1
  • 1
    $SHELL might not be changed if you have started a new shell from your interactive shell. Commented Dec 27, 2022 at 14:00

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.