Skip to content

Tag: scripting

All the articles with the tag "scripting".

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.

find Flags You Keep Forgetting

find Flags You Keep Forgetting

Practical find command examples: -mtime, -newer, -type, -exec vs xargs, -not, size filters. The patterns you google every time.