echo 'Compiling everything in ./compile...' targets="" for i in ${1+"$@"} do targets="$targets it-$i" done ( cd compile; exec make ${1+$targets} ) cp_commands() { dest="$1" shift for c in ${1+"$@"} do rm -f $dest/$c'{new}' cp -p compile/$c $dest/$c'{new}' mv -f $dest/$c'{new}' $dest/$c done } targets="" for i in ${1+"$@"} ${1-"all"} do if [ "$i" = "all" ] then targets="" for j in package/commands-* do targets="$targets $j" done break else targets="$targets package/commands-$i" fi done echo 'Copying commands into ./command...' for i in $targets do cp_commands command `cat $i` done