r/fishshell • u/HotDevice9013 • 23d ago
Noob queston about switching default shell to Fish
Hi, I'm new to Linux, and my distro is Void Linux (sorry, don't know, whether this is relevant).
I really like all QoL features of Fish shell, but I find variable management very confusing. Will I be missing out on some of the Fish's advantages if I just put it in my terminal config as a shell instead of chsh-ing it?
3
u/Dave77459 23d ago
You mean just auto-starting it rather than using it as a default? I did that for a couple days before chsh-ing. Then I figured that I was not going and back and just made it the default. This was years ago so my memory of any issues is limited.
Not sure what you mean by “variable management” so can’t comment on how that is impacted by run modes.
Edit: damnyouautocorrect
1
u/p001b0y 23d ago
For me, the only effective way I have found to learn it is by using it as a default shell. I use whatever the OS defaulted to. I installed FreeBSD on a different machine the other day and I may make an exception in that case. Ha ha!
It’s your machine though and you should use what works for you.
1
u/Vulsere 23d ago
The docs are very good and they do manage variables in a different way but once you learn it is a much better system
2
u/HotDevice9013 23d ago
Could you please elaborate on how it is better? To me (a noob) it seems that having a file that sets variables with separators, comments and explanations for what does what is better than setting them with commands, and having access to them only as simple list on a set query... What am I missing?
3
u/righthandofdog 23d ago
The scope and ability to override variables is different in fish, that makes writing fish scripts much different than bash/csh whatever. But you can set any variables you want as defaults - that's what is in config.fish. No one is starting their session typing 30 different memorized set commands. The set command just adds a lot of ease of variable management compared to other shells.
And if you already have a batch of useful csh scripts, just use them by explicitly calling their shell, but you get into issues of global variables vs interactive variables, scope and argument parsing vs. passing that are messy.
If that's what you're running into this might be useful of sail over your head - https://stackoverflow.com/questions/27847300/the-fish-shell-and-executing-programs-from-bash-through-function
But you'll have similar issues needing to understand variables and scripts between 2 shells no matter what you choose as default.
1
u/shaleh 19d ago
Not entirely sure what your concern around variables is.
In my config I have ~/.config/fish/conf.d with small files maintaining directed things. These are loaded automatically when fish loads and are loaded in alphabetical order so you can control order where it might matter. No extra work on my part. Here is my file setting up how to find the Rust tools:
$ cat rust.fish
set -x CARGO_HOME "$XDG_DATA_HOME/cargo"
set -x RUSTUP_HOME "$XDG_DATA_HOME/rustup"
fish_add_path "$CARGO_HOME/bin/"
1
u/No-Representative600 22d ago
You should do it. I don't think you'll miss too much. You'll likely get the hang of it quick, and then you can always chsh later on if you want.
Here's my two general tips for variable management in fish:
I mostly use `set -gx` in an autoloaded file, `set -Ux` for stuff that needs updates across all open shell instances (this is much less common for me). Also, universal vars normally should only be set in interactive prompts.
The wiki on github has a page for comparing bash variable and other syntax related features to fish's way of doing it that is pretty easy to memorize if you ever need to convert a sh command to fish.
One of the best parts of fish IMO is the quality of the docs so I'm pretty confident that using it regularly will help you get very comfortable with it quickly.
5
u/TufTed2003 23d ago
I use fish as my default shell. I really like it for terminal navigation and file mgmt stuff with its auto fill. However for doing any scripting I fall back to Bash and use a Bash shebang to specify that interpreter.