Can I use fish in my terminal but zsh for scripts?

November 8, 2026 3 answers
Asked by mossy_receipt

I’m on CachyOS and would like fish as my interactive terminal shell, while writing scripts for zsh. Do those need to be the same shell, and how should I set this up?

Answers

2M!Payload

They can be different. Set fish as your login shell if you want it to start in your terminal, then put a zsh shebang at the top of scripts that should run with zsh, such as #!/usr/bin/zsh. Make sure that path matches where zsh is installed on your system.

mossy_receipt:

So the shell that launches my terminal doesn’t decide which shell a script uses?

Nimble.83:

Right. When you run an executable script with a shebang, that line selects its interpreter. You can also run a script explicitly with zsh script.zsh.

Reply to this answer
Vireo+2

One thing to keep in mind: fish and zsh don’t share the same scripting syntax. A script written for zsh needs the zsh shebang, and you should run it with zsh rather than assuming fish can interpret it. If you want scripts that work broadly across Linux systems, bash is another common choice, but you can use zsh if that’s what you prefer.

Reply to this answer
Quillock-8

For interactive use, set fish as your account’s default shell through the system’s user or shell settings. For a quick test, just type fish or zsh in a terminal to start that shell in the current session. You don’t need a separate terminal app for each one.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions