Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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?

share|improve this question

marked as duplicate by kos, Gunnar Hjalmarsson, glenn jackman, Eric Carvalho, muru Mar 26 at 14:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

@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. – Gerard Mar 21 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 at 13:20
@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:… – Gerard Mar 21 at 14:50
up vote 5 down vote accepted

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
share|improve this answer
Well, it returns the same as before: /usr/bin/fish. When I change it with the command chsh (as root), it returns: «Authentication error». – Gerard Mar 21 at 12:52
Opening the file /etc/passwd I can see the first line: «root:x:0:0:root:/root:/bin/zsh5» – Gerard Mar 21 at 12:54
@Gerard Exactly, it returned /usr/bin/fish expectedly..check for which user you are running the command.. – heemayl Mar 21 at 12:56
So it's the expected output... I thought it was wrong. Then it's everything ok. Thanks! :) – Gerard Mar 21 at 12:59
@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. – glenn jackman Mar 21 at 16:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.