how to set environment variables in fish shell

后端 未结 4 1257
一向
一向 2021-01-30 07:59

Can someone please tell me what\'s the correct way to set a bunch of environment variables in the fish shell?

In my .config/fish/config.fish file, I have a function to s

4条回答
  •  被撕碎了的回忆
    2021-01-30 08:35

    Use Universal Variables

    If the variable has to be shared between all the current user fish instances on the current computer and preserved across restarts of the shell you have to use -U or --universal:

    set -Ux FOO bar
    

    Using set with -g or --global doesn't set the variable persistently between shell instances


    Note:

    Do not append to universal variables in config.fish file, because these variables will then get longer with each new shell instance. Instead, simply run set -Ux once at the command line. And it will be stored in the file .config/fish/fishd.MACHINE_ID, where MACHINE_ID is typically your MAC address.

提交回复
热议问题