- Mastering Linux Shell Scripting
- Andrew Mallett
- 202字
- 2021-07-30 09:40:46
Script comments
We should always introduce commenting scripts early in the piece. A script comment is prefaced with a #
symbol. Anything after the #
symbol is a comment and is not evaluated by the script. The shebang, #!/bin/bash
, is primarily a comment and, as such, is not evaluated by the script. The shell running the script reads the shebang so it knows which command interpreter to hand the script over to. A comment may be at the start of a line or partly into the line. Shell scripting does not have the notion of multi-line comments.
If you are not already familiar with comments, then they are added to the script to tell all about who wrote the script, when it was written and last updated, and what the script does. It is the metadata of the script.
The following is an example of comments in scripts:
#!/bin/bash # Welcome script to display a message to users on login # Author: @theurbanpenguin # Date: 1/1/1971
It is a good practice to comment and add comments that explain what the code is doing and why. This will help you and your colleagues, who need to edit the script at a later date.
- iOS開發(fā)實戰(zhàn):從零基礎(chǔ)到App Store上架
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- Practical Game Design
- 名師講壇:Java微服務(wù)架構(gòu)實戰(zhàn)(SpringBoot+SpringCloud+Docker+RabbitMQ)
- FLL+WRO樂高機(jī)器人競賽教程:機(jī)械、巡線與PID
- Python貝葉斯分析(第2版)
- 算法訓(xùn)練營:提高篇(全彩版)
- Building an RPG with Unity 2018
- Symfony2 Essentials
- 軟件測試實用教程
- MySQL入門很輕松(微課超值版)
- ASP.NET 4.0 Web程序設(shè)計
- 遠(yuǎn)方:兩位持續(xù)創(chuàng)業(yè)者的點(diǎn)滴思考
- Java程序設(shè)計教程
- Python機(jī)器學(xué)習(xí)開發(fā)實戰(zhàn)