Reputation: 43
I have a filesystem structured like this:
Within the init.sh, I have:
#!/bin/bash
set -e
######################
# Run all installers #
######################
cd "$(dirname $0)"/..
# find the installers and run them interatively
find ../ -name install.sh -type f -exec chmod a+x {} \;
find . -name install.sh | while read installer ; do sh -c "${installer}" ; done
This works for the most part, but it is fragile. If one of the install.sh scripts encounters a problem, the init.sh script stops. I'd like for it to continue on to the next install.sh script if this happens. But I'm not sure how to get that to work.
Upvotes: 0
Views: 219
Reputation: 176
Replacing sh -c "${installer}"
with sh -c "${installer} || true"
should work, since true
always returns 0.
Upvotes: 1