Skip to content

Tag: bash

All the articles with the tag "bash".

trap in Bash: Clean Up When Your Script Dies

trap in Bash: Clean Up When Your Script Dies

· Updated:

Use trap EXIT to clean up temp files, INT/TERM for graceful shutdown, and ERR for errors. Stop your bash scripts from leaving messes when they die.

bash `set -e` Doesn't Work Like You Think

bash `set -e` Doesn't Work Like You Think

· Updated:

set -e looks bulletproof, but it slips right through pipes, command substitution, and conditionals. The bash gotchas that bite at 2 AM, and how to fix them.

Bash Arithmetic Without bc

Bash Arithmetic Without bc

Bash does arithmetic natively, so you can drop bc for most math. Arithmetic expansion, conditions, bitwise operators, and the trap inside $(( )).

jq One-Liners Every Sysadmin Needs

jq One-Liners Every Sysadmin Needs

· Updated:

jq is JSON on the command line. Here are 5 one-liners that actually solve real problems: filtering, extracting, transforming, combining, and debugging.

Why Your Cron Job Is Failing Silently

Why Your Cron Job Is Failing Silently

· Updated:

Cron runs a different PATH, mutes stdout, and breaks MAILTO quietly. Absolute paths, an explicit PATH, log redirection, and how to test a job first.