A bash scripting manual that teaches AI agents to write production-quality scripts.
Strict mode. Proper error handling. ShellCheck compliant.
Get the Manual#!/bin/bash
set -euo pipefail
main() {
local input="${1:-}"
printf "Hello, %s\n" "${input}"
}
main "$@"
Every script starts with set -euo pipefail. Errors fail fast, unset variables are caught, pipelines don't hide failures.
Scripts pass ShellCheck with zero warnings. Quoted variables, proper escaping, no common pitfalls.
Works with any AI agent that reads markdown. Claude, GPT, Gemini, Llama, or your own local model.
Ask any AI with this manual to "check disk usage" and you get:
#!/bin/bash
set -euo pipefail
THRESHOLD=80
check_disk_usage() {
local mount_point="$1"
local usage
if ! usage=$(df "${mount_point}" | awk 'NR==2 {print $5}' | tr -d '%'); then
printf "error: failed to get disk usage for %s\n" "${mount_point}" >&2
return 1
fi
if [[ "${usage}" -gt "${THRESHOLD}" ]]; then
printf "ALERT: %s is at %d%% (threshold: %d%%)\n" \
"${mount_point}" "${usage}" "${THRESHOLD}"
return 1
fi
printf "OK: %s is at %d%%\n" "${mount_point}" "${usage}"
}
main() {
local mount_point="${1:-/}"
check_disk_usage "${mount_point}"
}
main "$@"
This website uses cookies to enhance your experience.