The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 07-17-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,805
This is really not a great shell coding best practice but

Code:
somecommand arg1 || somecommand arg1

executes somecommand1 an additional time if it fails the first time.

This will NOT work with pipes i.e., command1 | command2 because the status returned is from the rightmost element in the line, but others may fail. Some implementations have a workaround for this problem.