The Living Thing / Notebooks :

The Fish shell

Finally, a command line shell that thinks that the problem is not you

Not the aquatic creature, but rather the command-line doohickey, which is not as shit as the other ones. I’m gradually transitioning to fish, after accidentally losing a lot of precious data due to a quirk in bash syntax. Long boring story. It’s time for new, exciting, different stupid errors.

fish has a strong fanbase and principled, opinionated design. If nothing else, it has a healthy degree of sarcasm in its documentation which sarcasm is sorely absent from the drearily earnest nerdview of your typical gnu.org project.

Pro tips

Things I forget

modifying the path

Adding a path? Put

set PATH <mydir> $PATH

in ~/.config/fish/config.fish.

OR

set -U fish_user_paths /usr/local/bin $fish_user_paths

Removing a path?

set PATH (string match -v /usr/local/bin $PATH)

Python environments

virtualenv

if you are still using virtualenv on python you will need virtualfish to replace python’s virtualenvwrapper.sh. (or switch to native python3 venv, which works better in other ways too)

Using anaconda python

You need to do some extra setup to use conda with fish. Specifically, add the line

source ~/anaconda3/etc/fish/conf.d/conda.fish

into ~/.config/fish/config.fish.

(Replace ~/anaconda3/ with the output of conda info --root if you used a nonstandard install location)

Now you can activate an anaconda environemnt, e.g. the default base environment:

conda activate base

modifying any settings with GUI

fish_config

loop syntax

while true
    echo "Loop forever"
end

Temporary variable setting uses `env`

env FOO=BAR baz.sh

Execute the second command if the first succeeded

The commmand you want is and, which is hard to google for

../bin/something.sh foo; and cp foo ~/Dropbox/