c_exercises/compile.sh

6 lines
210 B
Bash
Executable File

#!/bin/bash
[ -z "${1}" ] && echo "error: no arguments given" && exit 2
[ "${1}" == "clean" ] && rm -v $(ls --color=no -1 | grep -v "\(\.c\|\.sh\)$") && exit
gcc -Wall -Wextra -O2 -g -o "${1:0:-2}" "${1}"
exit