Default shell in my mac was bash.
I have tried to change it into ZSH by command chsh -s /bin/zsh
.
Now when I am trying to check the shell type, I am getting different responses.
input : echo $SHELL
output : /bin/zsh
input : ps $o
output : 7655 ttys002 0:00.03 -bash
input : ps -p $$ | awk '$1 == PP {print $4}' PP=$$
output : -bash
I am not sure which shell I am using. Do I need to do something additional to change my shell into ZSH.
In the Terminal app on your Mac, choose Terminal > Preferences, then click General. Under “Shells open with,” select “Command (complete path),” then enter the path to the shell you want to use.
How to check which shell am I using: Use the following Linux or Unix commands: ps -p $$ – Display your current shell name reliably. echo "$SHELL" – Print the shell for the current user but not necessarily the shell that is running at the movement.
Update your Terminal preferences to open the shell with the command /bin/bash , as shown in the screenshot above. Quit and restart Terminal. You should see “hello from bash”, but if you run echo $SHELL , you will see /bin/zsh .
Now, coming to the article's main subject, how will you know that you have bash or zsh? The answer is quite simple. Use the “–version” command to confirm the existence of both shells on your Linux system.
Assuming you're using the standard Terminal.app
and you've verified that it is indeed configured to use your default login shell, as described in NobodyNada's helpful answer:
To see what shell is currently running (which may or may not be your default shell), use:
ps -o comm= $$
To see what shell is your default shell, run:
echo $SHELL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With