FDD-book/src/chapters/3/case/case.sh
Edson Brandi c7c03a1da2
Add Chapter 3 shell scripting examples
Add comprehensive shell scripting examples covering fundamental concepts:
- Basic scripts: hello.sh, vars.sh, status.sh
- Control flow: case.sh, loops.sh
- Functions and debugging: functions.sh, debug_demo.sh
- File handling: list_files variants (POSIX, bash, exec approaches)
- Practical utilities: backup.sh, organize_downloads.sh
- Advanced topics: IFS handling, temporary file management

These examples demonstrate portable shell scripting practices for
FreeBSD driver development workflows.
2025-11-07 22:00:05 +00:00

20 lines
332 B
Bash
Executable file

#!/bin/sh
# case.sh handle options with a case statement
action="$1" # first command line argument
case "$action" in
start)
echo "Starting service"
;;
stop)
echo "Stopping service"
;;
restart)
echo "Restarting service"
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 2
;;
esac