Showing results for 
Search instead for 
Do you mean 

Syntex erros


Syntex erros

Hi All,


OS :- HPUS 11.11


I am using following script to compare dates. While executing , it throwing me following errors, since the script not execcuted fully, I am not sure, weather this is right way to compare dates. Also, not sure about the syntex part.


none> ./
./[7]: Syntax error at line 7 : `;' is not expected.
oradev3 oraadmin /home/oraadmin/test/dev_monitoring
none> cat -n
     1  #!/sbin/sh
     2  SID=qfin1
     3  . qa02
     4  typeset -i mHHMM=`date +%H%M`
     5  typeset -i mDD=$(date +%d)
     6  mDay=`date +%a`
     7  if [[ "${mDay}" = "Fri" && ${mHHMM} -gt 1604]]; then
     8  echo "Test succeded"
     9  fi


Acclaimed Contributor [Founder]

Re: Syntex erros



You need a space character before the closing square brackets on line-7.


if [[ "${mDay}" = "Fri" && ${mHHMM} -gt 1604 ]]; then

It's better form to avoid the archaic backtick syntax and use the modern Posix standard of $( ... ).  You did this line line-5.  This improves readability and helps eliminate typos that use a backtick instead of a single quote and vice versa.