if date -d "2012010123"
runs if the date command returns a zero exit code. How do I get the opposite to occur? In other words, how can I get the if statement to run if the exit code is 1?
Negate it:
if ! date -d "2012010123"; then
# do something here (date returned with non-zero exit code)
fi
Quoting from help test
:
! EXPR True if expr is false.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments