Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are universal variables stored in the fish shell?

Tags:

shell

fish

set -xU CFLAGS "-g" will set a universal variable that will persist across sessions. So this variable value must be store in the filesystem somewhere. Where exactly?

I would like to put this file under version control (git) in my ~/dotfiles/.

like image 960
RubenLaguna Avatar asked Nov 20 '13 18:11

RubenLaguna


People also ask

How do fish export variables?

To give a variable to an external command, it needs to be “exported”. Unlike other shells, fish does not have an export command. Instead, a variable is exported via an option to set , either --export or just -x .

How variables are stored in shell?

Shell variables are stored in the memory of the running shell. Use any data structure that lets you easily look up an item given its name; a hash table is a good choice. The difference between shell variables and environment variables is that environment variables are placed in the environment of subprocesses.

Where is fish config stored?

The configuration file runs at every login and is located at ~/. config/fish/config. fish . Adding commands or functions to the file will execute/define them when opening a terminal, similar to .

Where are fish functions stored?

For the first issue, all functions live in your home directory under ~/. config/fish/functions . They're automatically loaded to the list of functions you can access from the fish shell, so there's no need to add the directory to the path yourself.


1 Answers

Since fish version 3.0.0 the file lives in the more portable location ~/.config/fish/fish_variables – Joey Sabey (Edited to be absolute rather than relative path)


in ~/.config/fish/fishd.(hostname)

Since it's host-specific, I'd recommend you put settings you want to share in ~/.config/fish/config.fish

like image 53
glenn jackman Avatar answered Oct 05 '22 13:10

glenn jackman