Skip to content

Instantly share code, notes, and snippets.

@gjbianco
Created January 16, 2020 20:18
Show Gist options
  • Save gjbianco/de7fc8361410f1ce334ff74e1978dcdf to your computer and use it in GitHub Desktop.
Save gjbianco/de7fc8361410f1ce334ff74e1978dcdf to your computer and use it in GitHub Desktop.
bash --> fish

Regular bash scripts can be used in fish shell just as scripts written in any language with proper shebang or explicitly using the interpreter (i.e. using bash script.sh). However, many utilities, such as virtualenv, modify the shell environment and need to be sourced, and therefore cannot be used in fish. Sometimes, counterparts (such as the excellent virtualfish) are created, but that's often not the case.

Bass is created to make it possible to use bash uilities in fish shell without any modification. It works by capturing what environment variables are modified by the utility of interest, and replay the changes in fish.

You might not need Bass for simple use cases. A great simple alternative (suggested by @jorgebucaran) is to just use

exec bash -c "source some-bash-setup.sh; exec fish"

(originally taken from https://github.com/edc/bass)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment