How do I get the opposite of the if construct in Bash?

imagineerThat

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?

devnull

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I get the opposite of the if construct in Bash?

From Dev

How do I get the opposite results?

From Dev

How do I swap around this formula to get the opposite value?

From Dev

How do I turn the trapezoid opposite?

From Dev

How do I get a REPL in bash?

From Dev

How do I get a colored bash?

From Dev

How do I construct an array of ctype structures?

From Dev

How do I construct a list with numbers like this?

From Dev

How do I construct an Esri grid?

From Dev

How do i use a variable to construct a sequence?

From Dev

How do I construct a JFrame child class?

From Dev

Concurrent programming, how do i construct a semaphore?

From Dev

How do I make the tuple order the opposite way around?

From Dev

How do I use opposite sign in where condition in dataProvider?

From Dev

How do I make a second window snap to the opposite side of the screen?

From Dev

In Redshift, how do I run the opposite of a SUM function

From Dev

How can I get the opposite value of a Bool in Swift?

From Dev

How do I construct get the whole sub graph from a given resource in RDF Graph?

From Dev

How do I construct get the whole sub graph from a given resource in RDF Graph?

From Dev

Why do I get 'Dead code following this construct' with the following code?

From Dev

How to get a opposite background by echo

From Dev

Bash: How do I get the wordcount of a file and insert it into the file itself?

From Java

How do I get the absolute directory of a file in bash?

From Dev

How do I use Bash to get a Ruby variable?

From Dev

How do I get console input to work with SSL in bash script?

From Dev

How do I get Cygwin xterm to use bash and not sh?

From Dev

How do I get bash to redirect stderr into a >( command substitution )?

From Dev

How do I get a part of the output of a command in Linux Bash?

From Dev

How do I get the bash debugger to work with ddd?

Related Related

  1. 1

    How do I get the opposite of the if construct in Bash?

  2. 2

    How do I get the opposite results?

  3. 3

    How do I swap around this formula to get the opposite value?

  4. 4

    How do I turn the trapezoid opposite?

  5. 5

    How do I get a REPL in bash?

  6. 6

    How do I get a colored bash?

  7. 7

    How do I construct an array of ctype structures?

  8. 8

    How do I construct a list with numbers like this?

  9. 9

    How do I construct an Esri grid?

  10. 10

    How do i use a variable to construct a sequence?

  11. 11

    How do I construct a JFrame child class?

  12. 12

    Concurrent programming, how do i construct a semaphore?

  13. 13

    How do I make the tuple order the opposite way around?

  14. 14

    How do I use opposite sign in where condition in dataProvider?

  15. 15

    How do I make a second window snap to the opposite side of the screen?

  16. 16

    In Redshift, how do I run the opposite of a SUM function

  17. 17

    How can I get the opposite value of a Bool in Swift?

  18. 18

    How do I construct get the whole sub graph from a given resource in RDF Graph?

  19. 19

    How do I construct get the whole sub graph from a given resource in RDF Graph?

  20. 20

    Why do I get 'Dead code following this construct' with the following code?

  21. 21

    How to get a opposite background by echo

  22. 22

    Bash: How do I get the wordcount of a file and insert it into the file itself?

  23. 23

    How do I get the absolute directory of a file in bash?

  24. 24

    How do I use Bash to get a Ruby variable?

  25. 25

    How do I get console input to work with SSL in bash script?

  26. 26

    How do I get Cygwin xterm to use bash and not sh?

  27. 27

    How do I get bash to redirect stderr into a >( command substitution )?

  28. 28

    How do I get a part of the output of a command in Linux Bash?

  29. 29

    How do I get the bash debugger to work with ddd?

HotTag

Archive