Code-Memo

Debugging and optimization

Quick debugging tools

Tracing

bash -x script.sh arg1 arg2

More controlled:

set -x
do_work
set +x

Common issues

Timing / profiling (lightweight)

time ./script.sh

Measure sections:

start="$(date +%s)"
do_work
echo "elapsed=$(( $(date +%s) - start ))s"

Performance tips