Hello, sometimes when I script I do things like this
Code:
find -name Makefile -exec sed 's/something/something-else/' {} \;
Which is fine if the sed makes sense. However, if the sed is broken in some way and gives an error the script continues because the exit status is given by `find' which succeeded. eg
Code:
find -name Makefile -exec sed 'some-rubbish' {} \;
sed: -e expression #1, char 14: unterminated `s' command
andy@eccles:~$ echo ${?}
0
How do I capture the exit status of the sed so I can make the script stop if there's a problem?