该脚本文件主要根据程序的扩展名来确定该程序属于C程序还是C++程序,然后根据不同情况,使用gcc或者g++编译器编译该程序。
#!/bin/bash
# =====================================
# Author : Anna
# exit_code :
# 2 -> Invalid Usage;
# 3 -> not a source code file
# =====================================
fileName=$1
option="$* -g -lpthread"
outFileName=`echo $fileName | cut -d. -f1`
AnalyseFile(){
if ! file $fileName | grep "ASCII" &> /dev/null;then
echo -e "\033[31m is not a ASCII file.\033[0m"
exit 3