Capture return code

This commit is contained in:
Bob Mottram 2016-10-23 23:35:59 +01:00
parent a61d02999c
commit 849430b2ce
1 changed files with 7 additions and 5 deletions

View File

@ -960,13 +960,14 @@ function restore_data_from_storage {
app_name=${app_list[app_index]}
if [[ $app_name == "$AllStr" ]]; then
$restore_command
if [ ! "$?" = "0" ]; then
retcode="$?"
if [[ "$retcode" != "0" ]]; then
if [[ "$1" == "local" ]]; then
dialog --title $"Restore all apps from USB" \
--msgbox $"Restore failed with code $?" 6 40
--msgbox $"Restore failed with code $retcode" 6 40
else
dialog --title $"Restore all apps from $1" \
--msgbox $"Restore failed with code $?" 6 40
--msgbox $"Restore failed with code $retcode" 6 40
fi
return
fi
@ -989,9 +990,10 @@ function restore_data_from_storage {
app_name=${app_list[app_index]}
if [ ${#app_name} -gt 0 ]; then
$restore_command "${app_name}"
if [ ! "$?" = "0" ]; then
retcode="$?"
if [[ "$retcode" != "0" ]]; then
dialog --title $"Restore apps from USB" \
--msgbox $"Restore of ${app_name} failed with code $?" 6 40
--msgbox $"Restore of ${app_name} failed with code $retcode" 6 40
return
fi
fi