Skip to content
Avindra Goolcharan edited this page Jun 4, 2021 · 21 revisions

🐟 sh

I use the Fish shell, which is a ground-up implementation that smooths out the rough edges of the ancient POSIX shell. It is the default shell I use since about Nov 2020.

ℹ️ Why Fish? This shell respects the tradition of the POSIX shell and implements the vast surface of the familiar APIs. In fact, it's parser will throw specific errors at you when it detects legacy shell syntax. From this, we are shown how all of the legacy semantics are encoded into the fish shell. This is a great comfort for any users who are familiar with traditional shells, and contributes greatly to the design of shell interfaces in general.

ℹ️ Why Fish? The real answer: it's a productive shell. I have tried the completion features of various shells and I find fish to be the most robust interactive experience.

ℹ️ Fish is required to use this repo, but you are welcome to use Bash as the profile is still around.

Rooted fish 🎣

One time setup: link your root profile to the user account fish:

$ sudo su -
$ whoami
# ensure you see root here
$ ln -s   /home/yourUserAccount/.config/fish/config.fish ~/.config/fish/config.fish

Now the configured fish environment is available as root!†

ℹ️ There is an abbreviation for su that will sudo to root using the fish shell. This is used to circumvent cases where Bash is still the chsh shell.

† Excepting plugins, which are better left in the scope of a user account.

randomVideo

randomVideo is implemented using the fish shell. It takes up to two parameters.

Usage: randomVideo $width [$height]

If height is not specified, it defaults to the width (i.e., the aspect ratio is square (that is, 1:1)).

The idea is to take bits from /dev/urandom (/dev/random should be an option) and shove it into a video player. Incidentally, what you see when you do that resembles static noise.

Fish tips

If you were a savvy bash user, you might be looking for a replacement for C-x C-e to edit your command with your favorite text editor. For not, Alt+e (or Alt+v) can be used to this end.

⚠️ Bash

I know how to use Bash and some facts about making shell scripts POSIX compliant and portable. Bash is robust and mature shell, but it certainly has quirks. Generally, if one runs into the edge cases where Bash fails, failing StackOverflow research and a bit of effort, you might ultimately move your logic into the codebase of a formal programming language.

  • KSH is older than Bash, and has subtle differences in its implementation of a Bourne shell
  • C shell is similar to these both, but with notable differences in the syntax of its control structures
    • In this regard, Tcsh is interesting and it is also the native shell of FreeBSD.

As an interface for the shell, Bash is a good practical choice as it is covers access to a wide variety of systems an individual might care about.

Formally, I stop using Bash after 2020 because software easy to port and containerize and thus knowing specific legacy shells bears less relevance than it did before the following: virtualization, containers (Docker) and finally cross-compile capable toolchains, which seems like the final nail in the coffin.

The Fish shell is a robust and friendly shell, and shares the good parts. And it's error reporter tells you how to convert your legacy shell semantics to the "fish"-native approach, which does end up looking cleaner when all is said and done.

PS1

Starship is a recently popular, modular (Rust) PS1 generator, with modules for many popular languages and build tools.

To install to the home bin directory:

curl -fsSL https://starship.rs/install.sh | bash  -s -- -b $HOME/bin