fish

A command line shell (and scripting language) with an emphasis on user friendliness. Prioritises usability over POSIX compliance. Stated another way, fish is to bash as Python is to C++
web | feed | project | issues | fsd | GPLv2only

Ubuntu package | fish
Alternative to | :bash

Notes

Make fish the default shell

After installing fish, make it the default shell with the following command:

chsh -s /usr/bin/fish

References:

Add directory to $PATH

You might want to add a directory to your $PATH so that you can call scripts from that directory, no matter which directory you are currently in. To do this, use the special variable fish_user_paths as follows:

set --universal fish_user_paths $fish_user_paths /YOUR/PATH/HERE

Notes:

References:

Remove directory from $PATH

Not as trivial as above, but still easy to do...

set --universal fish_user_paths <NEW LIST>
#note: does not include "$fish_user_paths"

Change environment variable

For other environment variables:

set --universal <VARIABLE_NAME> <VALUE>

To set before running a script (export for subcommand):

set -x <VARIABLE_NAME> <VALUE>

Add Python virtualenv to prompt

To emit your Python virtualenv to the prompt, you will need to make the following changes:

editor ~/.config/fish/functions/fish_prompt.fish

Add the following definition near the top:

if not set -q VIRTUAL_ENV
	set -g __fish_prompt_venv ""
else
	set -g __fish_prompt_venv (set_color --bold -b blue white) (basename "$VIRTUAL_ENV") "$__fish_prompt_normal "
	#note subtle space after 'normal' above
end

Finally add the new variable to the final echo command:

echo -n -s "$__fish_prompt_venv" "$__fish_prompt_user" "$USER" ...
#exact details on this line may vary

References:

POSIX compatibility layer

If it is made, it will be called pfish. https://github.com/fish-shell/fish-shell/wiki/POSIX-compatibility-thoughts

Highlighting in text editors

See https://github.com/fish-shell/fish-shell/issues/1812



Backlinks: desktop final-term bash posix python:pew microsoft:posh

CC0 / Public domain dedication To the extent possible under law, d3vid seaward has waived all copyright and related or neighboring rights to "fish in Grasmere notebook, including code snippets" (why? how?)