![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| rm & mv command failed due to too many files. | videsh77 | UNIX for Advanced & Expert Users | 9 | 05-16-2008 02:01 PM |
| Problem with Mail command: exec failed. errno=2. | hawkman2k | UNIX for Dummies Questions & Answers | 1 | 04-29-2008 09:50 AM |
| Fatal error: Command failed for target `build_crypto' | sayed_021 | SUN Solaris | 1 | 02-13-2008 12:16 PM |
| Failed to get value from a file using sed command | nir_s | Shell Programming and Scripting | 2 | 03-11-2006 05:53 PM |
| Solaris 9: make: Fatal error:Command failed for target | eldiego | UNIX for Dummies Questions & Answers | 2 | 10-28-2005 03:11 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Rerunning a command in a script that failed?
I have a script that occasionally has a command here and there that fails and I would like to set my script up to just re run the command if the exit code is 1.
Is there a simple way to do that without if/thens or redirecting to the command again? |
|
||||
|
This is really not a great shell coding best practice but
Code:
somecommand arg1 || somecommand arg1 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. |
|
||||
|
Quote:
I guess I will be a big boy and add in flow control for those commands failing ![]() |
|
||||
|
Quote:
![]() |
| Sponsored Links | ||
|
|