- 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.
- Mastering RabbitMQ
- Python爬蟲開發:從入門到實戰(微課版)
- Spring Boot+Spring Cloud+Vue+Element項目實戰:手把手教你開發權限管理系統
- DevOps Automation Cookbook
- JavaScript前端開發與實例教程(微課視頻版)
- Learning Unity 2D Game Development by Example
- Terraform:多云、混合云環境下實現基礎設施即代碼(第2版)
- HTML+CSS+JavaScript網頁設計從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- Elasticsearch Essentials
- Python Digital Forensics Cookbook
- C語言程序設計與應用實驗指導書(第2版)
- Java程序設計實用教程(第2版)
- Kotlin語言實例精解
- jMonkeyEngine 3.0 Beginner’s Guide
- Build Your Own PaaS with Docker