mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
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.
20 lines
332 B
Bash
Executable file
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
|