Aug 192013
 

#Example of how to check (validate) the input.
#Read the input and “Check” if it is correct.
#In this case it is checking if the date was input correctly.

read -p "Date (format yyyy-mm-dd): " input
check=$(date +%F)

if [ "$input" == "$check" ]; then
    echo "Right!"
else
    echo "False!"
fi

Source