Use date
date "+%d/%m/%Y" -d "09/99/2013" > /dev/null 2>&1
is_valid=$?
The date string must be in “MM/DD/YYYY” format.
If you do not get 0 then date is in invalid format.
More Related Contents:
- Print a file’s last modified date in Bash
- How can I check if a directory exists in a Bash shell script?
- Difference between sh and Bash
- Pass commands as input to another command (su, ssh, sh, etc)
- Why do you need ./ (dot-slash) before executable or script name to run it in bash?
- Bash tool to get nth line from a file
- Which characters need to be escaped when using Bash?
- How to run the sftp command with a password from Bash script?
- “~/Desktop/test.txt: No such file or directory”
- Test for non-zero length string in Bash: [ -n “$var” ] or [ “$var” ]
- How to check the exit status using an ‘if’ statement
- Convert date time string to epoch in Bash
- YYYY-MM-DD format date in shell script
- How to suppress Terminated message after killing in bash?
- Delete files older than 10 days using shell script in Unix [duplicate]
- “Invalid Arithmetic Operator” when doing floating-point math in bash
- Copy folder recursively, excluding some folders
- Variable interpolation in the shell
- How do I pause my shell script for a second before continuing?
- Get the date (a day before current time) in Bash
- Is there a way to make bash job control quiet?
- What does ” 2>&1 ” mean?
- Bash regex =~ operator
- How do I check if a directory exists or not in a Bash shell script?
- Convert Unix timestamp to a date string
- Using Bash to display a progress indicator (spinner) [duplicate]
- Extract version number from a string
- How to properly nest Bash backticks
- How to include nohup inside a bash script?
- Subtract two variables in Bash