Parameter Expansion Patterns
Parameter expansion patterns I’ve actually used. Every entry has a date and context.
2026-04-04: Guard Missing Source Files
Problem: .zshenv sources ~/.cargo/env but file doesn’t exist until Rust is installed, causing warnings on every shell start
Context: P16g first boot, zsh startup errors
The Fix:
# WRONG: fails if file doesn't exist
source ~/.cargo/env
# RIGHT: guard with file existence check
[[ -f ~/.cargo/env ]] && source ~/.cargo/env
Rule: Always guard source commands with [[ -f path ]] — the file may not exist on every machine.
Worklog: WRKLOG-2026-04-04