Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Environment variables in Fish

📅 2015-Jul-31 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ environment variables, fish ⬩ 📚 Archive

Environment variables can be set just like any other variable in the Fish shell.

set -x FOO_ENV_VAR /home/joe/bin/some_foo_dir
set -x FOO_ENV_VAR /home/joe/bin/some_foo_dir /usr/local/foo_dir

Under Bash, you might have set this same environment variable in ~/.bashrc as:

export FOO_ENV_VAR=/home/joe/bin/some_foo_dir:/usr/local/foo_dir
set -x PATH /home/joe/bin/some_foo_dir $PATH
set -x FOO_ENV_VAR "/home/joe/bin/some_foo_dir:$FOO_ENV_VAR"

Tried with: Fish 2.2 and Ubuntu 14.04


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧