Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
scripting:basics [2015/08/02 04:30] bill_thomson |
scripting:basics [2019/08/30 09:07] (current) ersen [Comments] [Fix a typo] |
||
---|---|---|---|
Line 134: | Line 134: | ||
===== Comments ===== | ===== Comments ===== | ||
- | In a larger, or complex script, it's wise to comment the code. Comments can help with debugging or tests. Comments are stat with the # character (hashmark) and continue to the end of the line: | + | In a larger, or complex script, it's wise to comment the code. Comments can help with debugging or tests. Comments start with the # character (hashmark) and continue to the end of the line: |
<code bash> | <code bash> | ||
#!/bin/bash | #!/bin/bash | ||
Line 165: | Line 165: | ||
</code> | </code> | ||
What happened? The '':'' pseudo command was given some input by redirection (a here-document) - the pseudo command didn't care about it, effectively, the entire block was ignored. | What happened? The '':'' pseudo command was given some input by redirection (a here-document) - the pseudo command didn't care about it, effectively, the entire block was ignored. | ||
- | One could say, **the whole block is a comment**. For completeness: To make the here-document possible, the shell might generate a temporary file in the ''/tmp'' directory. | ||
The here-document-tag was quoted here **to avoid substitutions** in the "commented" text! Check [[syntax:redirection#tag_heredoc | redirection with here-documents]] for more | The here-document-tag was quoted here **to avoid substitutions** in the "commented" text! Check [[syntax:redirection#tag_heredoc | redirection with here-documents]] for more |