Procházet zdrojové kódy

Capture return code

Bob Mottram před 8 roky
rodič
revize
849430b2ce
1 změnil soubory, kde provedl 7 přidání a 5 odebrání
  1. 7
    5
      src/freedombone-controlpanel

+ 7
- 5
src/freedombone-controlpanel Zobrazit soubor

960
             app_name=${app_list[app_index]}
960
             app_name=${app_list[app_index]}
961
             if [[ $app_name == "$AllStr" ]]; then
961
             if [[ $app_name == "$AllStr" ]]; then
962
                 $restore_command
962
                 $restore_command
963
-                if [ ! "$?" = "0" ]; then
963
+                retcode="$?"
964
+                if [[ "$retcode" != "0" ]]; then
964
                     if [[ "$1" == "local" ]]; then
965
                     if [[ "$1" == "local" ]]; then
965
                         dialog --title $"Restore all apps from USB" \
966
                         dialog --title $"Restore all apps from USB" \
966
-                               --msgbox $"Restore failed with code $?" 6 40
967
+                               --msgbox $"Restore failed with code $retcode" 6 40
967
                     else
968
                     else
968
                         dialog --title $"Restore all apps from $1" \
969
                         dialog --title $"Restore all apps from $1" \
969
-                               --msgbox $"Restore failed with code $?" 6 40
970
+                               --msgbox $"Restore failed with code $retcode" 6 40
970
                     fi
971
                     fi
971
                     return
972
                     return
972
                 fi
973
                 fi
989
             app_name=${app_list[app_index]}
990
             app_name=${app_list[app_index]}
990
             if [ ${#app_name} -gt 0 ]; then
991
             if [ ${#app_name} -gt 0 ]; then
991
                 $restore_command "${app_name}"
992
                 $restore_command "${app_name}"
992
-                if [ ! "$?" = "0" ]; then
993
+                retcode="$?"
994
+                if [[ "$retcode" != "0" ]]; then
993
                     dialog --title $"Restore apps from USB" \
995
                     dialog --title $"Restore apps from USB" \
994
-                           --msgbox $"Restore of ${app_name} failed with code $?" 6 40
996
+                           --msgbox $"Restore of ${app_name} failed with code $retcode" 6 40
995
                     return
997
                     return
996
                 fi
998
                 fi
997
             fi
999
             fi