免写#!/bin/bash脚本
时间:2011-01-01 来源:xyqcuijia
1 #!/bin/bash
2 #
3 while getopts ":a:d:" SW ; do
4 case $SW in
5 a)
6 AUTHOR=$OPTARG ;;
7 b)
8 DESC=$OPTARG ;;
9 \?)
10 echo "Unkown options."
11 exit 1
12 ;;
13 esac
14 done
15
16 shift $[$OPTIND-1]
17
18 if ! grep "#!/bin/bash" $1 &> /dev/null; then
19 cat>> $1 <<EOF
20 #!/bin/bash
21 #Description: ${DESC}
22 #Date: `date +"%F %T"`
23 #Author: ${AUTHOR=Cui}
24 #Version: 0.01
25
26 EOF
27 fi
28 vim +6 $1
29
30 wait
31 chmod u+x $1
2 #
3 while getopts ":a:d:" SW ; do
4 case $SW in
5 a)
6 AUTHOR=$OPTARG ;;
7 b)
8 DESC=$OPTARG ;;
9 \?)
10 echo "Unkown options."
11 exit 1
12 ;;
13 esac
14 done
15
16 shift $[$OPTIND-1]
17
18 if ! grep "#!/bin/bash" $1 &> /dev/null; then
19 cat>> $1 <<EOF
20 #!/bin/bash
21 #Description: ${DESC}
22 #Date: `date +"%F %T"`
23 #Author: ${AUTHOR=Cui}
24 #Version: 0.01
25
26 EOF
27 fi
28 vim +6 $1
29
30 wait
31 chmod u+x $1
相关阅读 更多 +