Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to source a file in Fish

📅 2014-Feb-27 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ fish, source ⬩ 📚 Archive

The command to source the contents of a file in the Fish shell is the same as bash: . The documentation for this command is here.

For example, to test if a file exists and source it:

if test -e ~/.foobar
    . ~/.foobar
end

Tried with: Fish 2.1.0 and Ubuntu 12.04 LTS