From: eliot Date: Sat, 13 Jun 2020 10:43:24 +0000 (+0200) Subject: Updated Linux script 2020, but ikiwiki still breaks it somehow! X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=4f4cf9f93597c1370e6da39eec327bc6570368bb;p=inbyggd-frihet-wiki.git Updated Linux script 2020, but ikiwiki still breaks it somehow! --- diff --git a/linux-intro/linux_exam2020.txt.mdwn b/linux-intro/linux_exam2020.txt.mdwn index cc84ca2..9c42fef 100644 --- a/linux-intro/linux_exam2020.txt.mdwn +++ b/linux-intro/linux_exam2020.txt.mdwn @@ -23,9 +23,11 @@ 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 @@ -85,18 +87,22 @@ "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="" @@ -119,9 +125,10 @@ 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 @@ -168,7 +175,7 @@ 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 @@ -178,9 +185,11 @@ case $1 in "-shop") user_mode $2 + #break ;; *) help + #break ;; esac #Too many arguments show help