1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/sh args="-Wall --pedantic" case $1 in make) for f in *.c; do printf "Compiling %s\n" $f gcc $f -o $(echo $f | sed 's/\.c//') $args done ;; clean) for f in *.c; do rm $(echo $f | sed 's/\.c//') done ;; *) printf "'%s' is not an option!\n" $1 ;; esac