\section set set - Handle environment variables.
\subsection set-synopsis Synopsis
set [OPTIONS] VARIABLE_NAME [VALUES...]
The set builtin causes fish to assign the variable VARIABLE_NAME the values VALUES....
\subsection set-description Description
- -e or --erase causes the specified environment variables to be erased
- -g or --global causes the specified environment variable to be made global. If this option is not supplied, the specified variable will dissapear when the current block ends
- -l or --local forces the specified environment variable to be made local to the current block, even if the variable already exists and is non-local
- -n or --names List only the names of all defined variables
- -q or --query test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that where not defined.
- -u or --unexport causes the specified environment not to be exported to child processes
- -U or --universal causes the specified environment variable to be made universal. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
- -x or --export causes the specified environment variable to be exported to child processes
If set is called with no arguments, the names and values of all
environment variables are printed.
If set is called with only one argument, the scope of the variable
with the given name will be changed as specified, but it's value will
remain the same. If the variable did not previously exist, it's value
will be an empty string.
If the \c -e or \c --erase option is specified, all the variables
specified by the following arguments will be erased
If a variable is set to more than one value, the variable will be an
array with the specified elements.
If the variable name is one or more array elements, such as PATH[1
3 7], only those array elements specified will be changed.
\subsection set-example Example
set foo hi sets the value of the variable foo to be hi.
set -e smurf removes the variable \c smurf.
set PATH[4] ~/bin changes the fourth element of the \c PATH array to \c ~/bin