Tag:Is it correct

  • Shell script to determine whether the date entered is correct

    Time:2021-6-11

    Today’s topic is to determine whether the input date is correct, using the function in our previous 03 exampleHere’s the code #!/bin/sh # valid-date — Validates a date, taking into account leap year rules. exceedsDaysInMonth() { case $(echo $1|tr ‘[:upper:]’ ‘[:lower:]’) in jan* ) days=31 ;; feb* ) days=28 ;; mar* ) days=31 ;; apr* […]