Short Circuit Logic
<<<< ^^^^^ >>>>
zero.sh
#!/bin/bash
exit 0

    
one.sh
#!/bin/bash
exit 1




test.sh
#!/bin/bash
./zero.sh || echo zero or
./one.sh || echo one or
./zero.sh && echo zero and
./one.sh && echo one and
./nonexistent.sh || echo nonexistent or
./nonexistent.sh && echo nonexistent and
test "a" = "a" || echo test \"a\" = \"a\" or
test "a" = "a" && echo test \"a\" = \"a\" and
test "a" = "b" || echo test \"a\" = \"b\" or
test "a" = "b" && echo test \"a\" = \"b\" and
<<<< ^^^^^ >>>>

 
 
 
 
Copyright (C) 2005 by Steve Litt, you can freely distribute unmodified copies if this copyright notice and disclaimer are intact.  This material originally appeared on Troubleshooters.Com.

This presentation has no warranty, express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the presentation is with you. Neither the author nor those who show the slideshow are responsible for any damage caused by errors, omissions, or anything else relating to this slideshow.
 

19.html

Exit Slideshow