【腳本基本格式】


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