Neither of these options seem to work. What am I doing wrong? ( leapb , leapc and iyr are integer values) if [[ $leapb -eq $iyr && $leapc -ne $iyr ]]; then leap=0 fi Alternatively, if [[ $leapb -eq $iyr ]] && [[ $leapc -ne $iyr ]]; then leap=0 fi When running this using iyr=1979 , leapb=1900 , leapc=1600 , the script doesn't reach the leap=0 line, with error msg stating -eq: unary operator expected .
Originally asked by Stephan on Stack Exchange (unix) (CC BY-SA 4.0).