Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

Using Bash I've often done things like cd /study && ls -la I understand that the double ampersand is telling the terminal don't execute part two of this command unless part one completes without errors.

My question is, Having just moved to the Fish shell and trying the same command I get an error stating I can't use && and instructing me to use a single & which I believe backgrounds the task which isn't what I want.

Can anyone tell me the correct syntax to run my old Bash command in the Fish shell?

share|improve this question
up vote 16 down vote accepted

Instead of &&, which doesn't exist in fish, use ; and the command and:

cd /study; and ls -la

According to the fish tutorial:

Unlike other shells, fish does not have special syntax like && or || to combine commands. Instead it has commands and, or, and not.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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