command and script question

3 posts / 0 new
Last post
ninjanoir78
ninjanoir78's picture
command and script question

hi, 

 

I see many scipts with that : #,  I would like to know if we need to put it in the script or if it is only for explanation?

 

exemple: 

 #Check if date is at least 2016 to validade VPN certificates

YEAR=`date "+%Y"`

while [ $YEAR -le 2016 ]; do
   /bin/echo "We do not have a valid date.\n" >> $LOGFILE
   /etc/init.d/ntpclient stop
   /usr/sbin/ntpclient -s -h pool.ntp.org
   /bin/sleep 2
   /etc/init.d/ntpclient start
   NOW=$(date +"%H:%M, %d-%m-%Y")
   YEAR=`date "+%Y"`

kamoj
kamoj's picture
You don't have to put "# and

You don't have to put "# and text to end of line" in the scripts - unless it is within quotes such as"#" or '#'...

pb1983
pb1983's picture
# means the line is a comment

# means the line is a comment, usually to explaine the following code