Skip to main content

Unix Shell

Use Warp as my terminal & Zsh as my shell. Fish & Oil seem like great shell alternatives. Pipr seems useful.

ShellCheck is great for linting scripts. How Warp works is a great read.

Variables

All active variables can be seen by running env.

  • $HOME - Expands to the path of my home folder.
  • $PS1 - Variable that represents my command prompt line.
  • $PATH - Special environment variable that contains the command path (list of system directories that the shell searches when trying to locate a command).

Notes

  • Scripts are run in subshells, and nothing is shared "upwards". That's the difference between running a script and sourcing one. A sourced (imported) script is run in your own script's namespace.
  • In shell everything is a string.
  • Children never touch parent environment. It can only if it runs as part of the current process (source, function, alias).
  • Pipes are used to connect one process's output with another process’s input.
  • /etc/paths.d define paths to add to $PATH globally to all users.