The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 12-14-2004
druuna druuna is offline
Registered User
 

Join Date: Feb 2004
Location: netherlands
Posts: 42
Hi,

The OR (||) and AND (&& ) operators can be used as well:

ls foo && cat foo

cat foo is only executed when ls foo has no errors (in this case, foo must exist)

ls foo || touch foo

touch foo is executes only when ls foo has an error (does not exist in this example)

Hope this helps.
__________________

The dead stay dead and the living only wait to join them........
Reply With Quote