#!/bin/bash # VERSION 2 # This script compiles C code for Physics 3340. # There may be any number of source files listed # as arguments, and the linked executable is given # the name of the first source file without its '.c' # extension. # if [ $# = 0 ]; then echo "No source files found" exit 1 fi for file in $@; do if [ ! -r $file ]; then echo "Source file $file does not exist" exit 2 fi done echo "gcc -Wall -Wshadow -o ${1%.*} $@ -lm" gcc -Wall -Wshadow -o ${1%.*} $@ -lm