A desktop support specialist is customizing an automated system maintenance script with a .sh file extension to execute on Linux and macOS workstations. To document recent configuration updates, the specialist needs to insert internal documentation lines into the script that will be ignored by the shell command interpreter during execution. Which syntax must the specialist use to denote commented lines in this script?
- Prepend each commented line with the # character.Answer
- BPrepend each commented line with the REM keyword.
- CPrepend each commented line with a single quote (') character.
- DPrepend each commented line with a double slash (//) prefix.
Answer
Prepend each commented line with the # character.
In Bash shell scripts (.sh), placing a hash character (#) at the start of a line instructs the shell command interpreter to treat that text as a comment and ignore it during script execution.
Step-by-Step Solution
Key Concept
Scripting language syntax and comment conventions (.sh vs .bat vs .vbs vs .js)