Initial commit: CLI walkthrough for CHEG 667-013

Six-module walkthrough covering navigation, files, reading/searching,
processes/editors, scripting, and advanced tools (ssh, regex, tar, etc.).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eric 2026-04-04 21:54:48 -04:00
commit c57d7539d8
10 changed files with 1415 additions and 0 deletions

31
05-scripting/weather.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
# weather.sh [-s STATE] [ZONE]
usage() { echo "Usage: $0 [-s STATE] [ZONE]" 1>&2; exit 1; }
STATE="de"
ZONE="001"
while getopts "s:" flag; do
case "$flag" in
s) STATE="$OPTARG" ;;
*) usage ;;
esac
done
shift $((OPTIND - 1))
# Allow 0 or 1 positional arg (ZONE)
if [ "$#" -gt 1 ]; then
usage
fi
if [ "$#" -eq 1 ]; then
if [[ ! "$1" =~ ^[0-9]{3}$ ]]; then
usage
fi
ZONE="$1"
fi
STATE="${STATE,,}" # lowercase
curl -s "https://tgftp.nws.noaa.gov/data/forecasts/zone/${STATE}/${STATE}z${ZONE}.txt"