Code Snippets

Tag: System

Install a Cron Job from a Script

Append a cron line idempotently with grep -q before crontab.

Author: chris

Trap SIGINT for Cleanup

Use `trap` to remove a tempdir even when the user hits Ctrl-C.

Author: chris

Check if a Command Exists

Use `command -v` — portable, no subshell, returns nonzero if missing.

Author: chris