Linux Shell脚本编程之if用法示例

来源:互联网 发布:天才密码少儿编程 编辑:程序博客网 时间:2024/05/21 06:47

************************程序文件名:create**************************

#!/bin/bashif [ -e $1 ]   #注意if中的空格段thenecho "the file is already exists!"else `touch $1``chmod u+x $1`echo "Finish!"ficase "$2" in"-g" ) `gedit $1`;;"-v" ) `gnome-terminal -x vi $1`;;"" )echo "";;* )echo "command error!";;esac
创建一个可执行文件,在文件名参数后可可以选用-o或者-g进行选择编辑工具打开;





0 0
原创粉丝点击