Shell - Run additional command on failure
Posted
by Shawn
on Stack Overflow
See other posts from Stack Overflow
or by Shawn
Published on 2010-04-16T14:04:36Z
Indexed on
2010/04/16
14:13 UTC
Read the original article
Hit count: 310
I have this script that I am currently running that works great for all instances but one:
#!/bin/sh
pdfopt test.pdf test.opt.pdf &>/dev/null
pdf2swf test.opt.pdf test.swf
[ "$?" -ne 0 ] && exit 2
More lines to execute follow the above code ...
How would I go about changing this script to run "pdf2swf test.pdf test.swf
" if "pdf2swf test.opt.pdf test.swf
" fails? If the second attempt fails, then I would "exit 2
".
Thanks
© Stack Overflow or respective owner