【脚本基本格式】


script standard:

脚本代码开头约定
1,第一行一般为调用使用的语言 2,程序名,避免更改文件名为无法找到正确的文件 3,版本号 4,更改后的时间 5,作者的相关信息 6,该程序的作用,及注意事项 7,最后是个本版的跟新简要说明

shell script list:

#!/bin/bash
#------------------------------------------------
#Filename: mysql.sh
#Revision: 1.0
#Date:    2019/11/06
#Author:   David
#Email:  dm_98K@163.com
#Website:  www.dengmeng.vip
#Description:This is the install mysql5.7 script
#-------------------------------------------------
#Copyright: 2019 David
#License: GPL
echo "hello world"
###变量关键地方设置为红色
r1="\033[1;31m"
n1="\033[0m"
Create the format of the script:
#!/bin/bash
cat > $1 <<EOF
#!/bin/bash
#------------------------------------------------
#Filename: $1
#Revision: 1.0
#Date: `date +%F`
#Author: David
#Email: dm_98K@163.com
#Website: www.dengmeng.vip
#Description:This is the $2 script
#-------------------------------------------------
#Copyright: `date +%Y` David
#License: GPL"
EOF
chmod +x $1
vim + $1

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM