如果有人有需要歡迎索取
#!/bin/bash #Program: #Compiler Objective-C or Objective-C++ #History: #2012/11/15 Cheng-Yo Fang First release PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH function compiler(){ cpName="" outName="" if [ $1 == 0 ] || [ $1 == 2 ]; then if [ -e $2 ]; then cpName=$2 outName=$3 gcc -o $outName $cpName -I /GNUstep/System/Library/Headers -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base -fconstant-string-class=NSConstantString echo "編譯完成" else echo "$outName檔案不存在" fi else echo "沒辦法編譯該程式" exit 0; fi } if [ $# == 0 ];then read -p "請輸入Object-C的檔案名稱" tempA read -p "請輸入執行檔名稱" tempB compiler 0 $tempA $tempB elif [ $# == 2 ];then compiler 2 $1 $2 else compiler fi