Recent Articles - Shell

Reliably Detecting Command Existence in Bash
Reliably Detecting Command Existence in Bash
Dec 7, 2024 · 4 min read

You'll find quite a few different methods suggested on the internet, and they all have their own problems.


Resetting the Working Directory on Shell Script Exit
Resetting the Working Directory on Shell Script Exit
Mar 5, 2024 · 3 min read

Sometimes you need to change the working directory in a shell script. You should take care to reset it back.


Automate Your macOS Default Settings
Automate Your macOS Default Settings
Feb 18, 2024 · 7 min read

You can use built-in CLI tools to apply your preferred macOS settings.


Bash Environment Variable Defaults
Bash Environment Variable Defaults
Apr 5, 2023 · 3 min read

Bash scripts can set defaults for environment variables that are optionally supplied at execution time.


Hash a String to a Number in Bash
Hash a String to a Number in Bash
Mar 5, 2023 · 2 min read

Sometimes you need to turn a stable string ID into a stable number ID, and it's relatively easy to do in Bash.


Automatically Execute Code Before & After Unix Commands
Automatically Execute Code Before & After Unix Commands
Jan 19, 2023 · 4 min read

It can be helpful to run some code automatically before or after calling a command, and it is easy to accomplish with shadowing functions.


Reliably Finding Executables in $PATH
Reliably Finding Executables in $PATH
Aug 27, 2021 · 4 min read

Most built-in commands commonly used to find executables in $PATH don't always work quite as expected, or are shell-specific.


Docker Shell vs. Exec Form
Docker Shell vs. Exec Form
Mar 22, 2021 · 4 min read

The RUN, ENTRYPOINT, and CMD, instructions all have two different forms they can be written in, and those forms change how each of those instructions behaves.


You Don't Need an Init System for Node.js in Docker
You Don't Need an Init System for Node.js in Docker
Mar 20, 2021 · 5 min read

But you do need to think about how your application handles exit signals.