Unix Shell Scripts   «Prev 

Comments in a Shell Script

#!/bin/sh
#=================================
# This sample script contains only 
# a few commands 
# ================================
# Request username and record for later use 
echo Please enter your name:
read MYNAME
# Confirm that the name is correct before proceeding 
echo Is $MYNAME the correct name?
read ANSWER
if[ANSWER ="Y"]
then
The first line of the script names the command interpreter.

Blank lines are skipped.

All comment lines are skipped; the first line to be executed is the line with the echo command.

The next line executed is the line containing the read command.

Blank lines and comments are skipped; the next echo command is then executed.

#!/bin/sh
#=================================
# This sample script contains only 
# a few commands 
# ================================
# Request username and record for later use 
echo Please enter your name:
read MYNAME
The next read command is executed, and the script proceeds with other commands, skipping all comment lines.