bash - My shell script for checking leap year is showing error -


#!/bin/bash  echo "enter year (yyyy)" read year  if[ $((year % 4)) -eq 0]    if[ $((year % 100)) -eq 0]          if[ $((year % 400)) -eq 0]                     echo "its leap year"     else            echo "its not leap year"     fi   else   echo "its not leap year"   fi else  echo "its not leap year"  fi 

its showing error on 7th line , on

[ $((year % 4)) -eq 0]  

you miss blanks nesessary in bash:

echo "enter year (yyyy)" read year  if [ $((year % 4)) -eq 0 ]   if [ $((year % 100)) -eq 0 ]         if [ $((year % 400)) -eq 0 ]                   echo "its leap year"     else            echo "its not leap year"     fi   else   echo "its not leap year"   fi else  echo "its not leap year"  fi 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -