Is there a way I can do something like run myscript.sh in fish ?

I am using Arch Linux, and have installed the fish shell together with oh-my-fish

Can someone tell me which file I must edit to add my custom shell startup commands?

In zsh it was the ~/.zshrc file. What is it in the fish shell?

I have a problem: if I put my stuff in bashrc it is not loaded by fish. If I enter bash commands in the fish file ~/.config/fish/config.fish, it throws errors

Is there a way to get fish to load an "sh" file so that I can put all my bash things in that file?


I tried sourcing .profile on fish startup and it worked like a charm for me.

just do :

echo 'source ~/.profile;clear;' >  ~/.config/fish/config.fish

Quit terminal or iterm2 followed by firing up an alias from .profile to test.


bash and fish have incompatible syntax, so they cannot share startup files. You can put startup commands in ~/.config/fish/config.fish.

However this is usually unnecessary! For creating functions or aliases, you can use autoloading functions. For setting variables, including env vars, you can use universal variables.

  • 1
    is there a way i can do something like run myscript.sh in fish – Mr Mixin Jun 23 '15 at 10:22
  • 1
    Of course you can: sh myscript.sh (or use "bash" instead of "sh"). However if you are expecting that script to set environment variables for you, it won't: fish does not have the same syntax as sh. You have to rewrite all your bash settings, variables, functions, etc, into fish. It's not that hard. Read the fish docs, and ask specific questions here if you run into problems. – glenn jackman Jun 23 '15 at 13:15
  • Adding folders to $PATH as universal variable: set -U fish_user_paths ~/.bin/ ~/.cargo/bin/ ... – arve0 Jun 16 '19 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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