shell脚本实现快速解析文件

2016-10-26  本文已影响111人  Vvpl

在学习shell脚本可以轻松实现简化我们在编程过程中的复杂操作.
下面是mygcc的代码:

value=$1 value1="${value:0-2}" filestyle=".c" if [ $# -eq 1 ] then if [ $value1 == $filestyle ] then if [ -e $1 ] then if [ -f $1 ] then if [ -e ./a.out ] then rm ./a.out fi gcc $1 if [ -e ./a.out ] then ./a.out fi fi else echo "$1 :not such file or directory" fi else echo "$1 not .c file" fi elif [ $# -eq 0 ] then echo "which file to be edited?" else echo "error:too many arguments." fi

此shell脚本的实现的伪代码:

  1. 判断文件的个数
上一篇下一篇

猜你喜欢

热点阅读