I am going through the fish shell tutorial and find that this simple if-else block does not work

if grep fish /etc/shells
            echo Found fish
else if grep bash /etc/shells
            echo Found bash
            echo Got nothing

Error message:

Found fish
fish: global root block
fish: Could not locate end of block. The 'end' command is missing, misspelled or
a ';' is missing.

       end - end a block of commands.

1 Answer 1


Probably you have a very old (1.x) version of fish installed, which predates the else-if construct. What does fish --version output? Ideally you want 2.1.0.

You must log in to answer this question.

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