1

First I installed fish and then I wanted to test zsh so I installed it. Actually I'm using zsh and it works perfect (at the moment): I can switch themes, enable plugins, etc...

But when I do:

echo $SHELL

it should return /bin/zsh, and by surprise it returns /usr/bin/fish

I'm using Kubuntu 14.04. Is it ok, or should I fix it?

3
  • @kos, It's similar but not the same. He asks how to switch from zsh to bash, while I'm already using zsh as I wanted. It's just this output that I don't understand.
    – Unix
    Mar 21, 2016 at 12:57
  • Well the linked question is a superset of your question: it asks why that happens and how to change that (not how to switch from Zsh to Bash), and has a good answer: so I'd say this question fits all the requirements to be closed as a duplicate of that question, unless I'm missing something.
    – kos
    Mar 21, 2016 at 13:20
  • 1
    @kos, you're right. The answer you linked contains a reference of the file /etc/passwd. Now I also found this related one with very interesting information about chsh command and the mentioned file: askubuntu.com/questions/195361/…
    – Unix
    Mar 21, 2016 at 14:50

1 Answer 1

5

SHELL always (well, if not set manually) expands to the login shell (defined in /etc/passwd) of the user, not necessarily the shell user currently using.

You can cross check with:

grep -Po '^username:.*:\K[^:]+$' /etc/passwd

Replace username with your real username.

If you want to change your login shell, modify /etc/passwd or better use chsh:

chsh -s /path/to/shell username
9
  • Well, it returns the same as before: /usr/bin/fish. When I change it with the command chsh (as root), it returns: «Authentication error».
    – Unix
    Mar 21, 2016 at 12:52
  • Opening the file /etc/passwd I can see the first line: «root:x:0:0:root:/root:/bin/zsh5»
    – Unix
    Mar 21, 2016 at 12:54
  • @Gerard Exactly, it returned /usr/bin/fish expectedly..check for which user you are running the command..
    – heemayl
    Mar 21, 2016 at 12:56
  • So it's the expected output... I thought it was wrong. Then it's everything ok. Thanks! :)
    – Unix
    Mar 21, 2016 at 12:59
  • 2
    @Gerard, get out of the habit of manually editing files. Get out of the habit of working as root. You're inevitably going to make an accident and screw up your system. It happens to everybody. Get comfortable using the correct commands (chsh) as the right user. Get comfortable using the sudo command when you temporarily need to elevate your privileges. Mar 21, 2016 at 16:46

Not the answer you're looking for? Browse other questions tagged .