if date -d "2012010123"executed if the date command returns a null exit code. How do I get the opposite? In other words, how can I get an if statement to run if the exit code is 1?
if date -d "2012010123"
Cancel it:
if ! date -d "2012010123"; then # do something here (date returned with non-zero exit code) fi
Quote from help test:
help test
! EXPR True if expr is false.