The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Rerunning a command in a script that failed?
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Rerunning a command in a script that failed?
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
4
(
permalink
)
07-17-2008
jim mcnamara
...@...
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.
jim mcnamara
View Public Profile
Find all posts by jim mcnamara
Find jim mcnamara's past nominations received
Find jim mcnamara's present nominations given