#----用于快速编译简单的C语言程序的shell脚本 By Joey-----#
#------运行之前设置以下权限chmod 777 cshell.sh-------#
#!/bin/sh
if [ $# != 1 ]
then
echo "Usage: test.sh cname"
echo "cname:the name of .c file"
else
echo "The executable file name is:" $1
gcc -o $1 $1.c
./$1
fi
#------------保存为shell文件即可----------------#
好处见下面的截图:
1.先新建一个测试程序:
2.然后比较两者的差别:
3.希望可以方便大家,当然这个程序只适合小型的只有一个文件的c程序。