Shell script issue
calorique opened this issue · 0 comments
calorique commented
In the ProperTree.command script file:
curl "$url" -o "$tempdir/python.pkg"
if [ "$?" != "0" ]; then
echo
echo " - Failed to install python!"
echo
exit $?
fi
The exit code( $?) of curl will be replaced by echo, it always be zerio. If it needs the exit code, use a variable to store, like this:
curl "$url" -o "$tempdir/python.pkg"
RET=$?
if [ "${RET}" != "0" ]; then
echo
echo " - Failed to install python!"
echo
exit ${RET}
fi
or more simple :
curl "$url" -o "$tempdir/python.pkg" || {
echo
echo " - Failed to install python!"
echo
}
because that the error was handled already and the exit code was dropped at last.