Writing try catch finally in shell
finally, shell, syntax, try-catch
Solution
Well, sort of:
{ # your 'try' block
executeCommandWhichCanFail &&
mv output
} || { # your 'catch' block
mv log
}
rm tmp # finally: this will always happen
Problem
Is there a linux bash command like the java try catch finally? Or does the linux shell always go on? ``` try { `executeCommandWhichCanFail` mv output } catch { mv log } finally { rm tmp } ```