In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
0. Standard format of professional scripts
Function 1 function 2main function main $*
1. Use the dos2unix command to convert scripts developed under windows
Dos2unix is not installed by default and can be installed by yum
# dos2unix web_jk.shdos2unix: converting file web_jk.sh to UNIX format...
2. Use echo command to debug
3. Debug using bash command parameters
# sh [- nvx] scripts.sh-n does not execute the script, only queries whether there is a problem with the script syntax and gives an error prompt. -v when executing the script, first output the contents of the script to the screen and then execute the script. If there is an error, it will also give an error prompt. -x * * displays the contents and output of the executed script to the screen for debugging super useful parameters!
4. Debug part of the script using set command parameters
-n read commands but do not execute-v display all lines read-x * * displays all commands and their parameters
Write in the script:
Set-xdiff / tmp/a.txt.ori / tmp/a.txtset + x
Tip:
Turn on the debugging function through the set-x command, and turn off the debugging function through set + x
5. Habits
The most important thing is to be proficient in syntax, coding habits and programming ideas, nip errors in the bud, reduce debugging burden and improve efficiency.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.