]> git.g-eek.se Git - inbyggd-frihet-wiki.git/commitdiff
Updated Linux script 2020, but ikiwiki still breaks it somehow!
authoreliot <eliot@web>
Sat, 13 Jun 2020 10:43:24 +0000 (12:43 +0200)
committerIkiWiki <ikiwiki.info>
Sat, 13 Jun 2020 10:43:24 +0000 (12:43 +0200)
linux-intro/linux_exam2020.txt.mdwn

index cc84ca28f9a9fcb91c5099712d33257728363a15..9c42feffe4e66e152eec5e2aeb5521b6bdf8e517 100644 (file)
             case $OPTION in
                 "$OPTION_1")
                     price_info
+                    #break
                     ;;
                 "$OPTION_2")
                     senior_rebate
+                    #break
                     ;;
                 *)  ;;
             esac
@@ -39,7 +41,7 @@
             read  ARTICLE
     
             #article code length (includes '\n')
-            let ARTICLE_LEN="$(echo "$ARTICLE" | wc -m )"
+            ARTICLE_LEN="$(echo "$ARTICLE" | wc -m )"
             if [ ! $ARTICLE_LEN -eq "8" ]; then
                 echo "Invalid length of article code"
                 echo "Expected 7, got $ARTICLE_LEN" 1>&2
                 "64964")
                     PRICE=$(awk "BEGIN {print 120*${PRICE_MULTIPLIER}}")
                     echo -e "$ARTICLE (USB stick): $PRICE kronor\n"
+                    #break
                     ;;
                 "59457")
                     PRICE=$(awk "BEGIN {print 400*${PRICE_MULTIPLIER}}")
                     echo -e "$ARTICLE (headset): $PRICE kronor\n"
+                    #break
                     ;;
                 *)
                     echo -e "Hm, well I can't seem to find the product ($ARTICLE) in our system!\n"
+                    #break
                     ;;
             esac
         done
     }
     
+    #TODO the age calculation is probably not exact!
     function senior_rebate {
         BIRTHDAY=""
     
         fi
     }
     
+    
+    #tech_mode is entered by a Trap
+    #(as long as we are in a trap no additional traps can be made)
     function tech_mode {
-        #ignore SIGINT signals
-        trap "" SIGINT
         #Reset errors to tty
         exec 2>/dev/tty
         #Errors and warnings goes to both TTY and file
     exec 2>file.log
     
     #CTRL+C triggers admin mode (requires password)
-    trap "tech_mode" SIGINT
+    trap tech_mode SIGINT
     
     #0-1 arguments always shows help
     if [ $# -lt 2 ]; then
         case $1 in
             "-shop")
                 user_mode $2
+                #break
                 ;;
             *)
                 help
+                #break
                 ;;
         esac
     #Too many arguments show help