diff --git a/Labb4/ovning3_script2.sh b/Labb4/ovning3_script2.sh index ff3c63d..bcd004a 100755 --- a/Labb4/ovning3_script2.sh +++ b/Labb4/ovning3_script2.sh @@ -4,5 +4,19 @@ # LX13 # Övning 3, script 2, labb4 +# Testing parameter substiution + +Arg1="$1" + +echo "Hej ${USER}@${HOSTNAME}" +echo "" +echo "Variabler på U: ${!U*}" +echo "Variabler på S: ${!S*}" +echo "" +echo ${Arg1:?"No arg1 input"} + +echo "Du skrev in ${#Arg1} tecken som argument till $0" + +exit 0 diff --git a/jack.sh b/jack.sh new file mode 100755 index 0000000..bdb5f04 --- /dev/null +++ b/jack.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Jack-Benny Persson +# LX13 +# From the classic movie The Shining + +Text=(A l l " " w o r k " " a n d " " n o " " p l a y " " m a k e s " " \ +J a c k " " a " " d u l l " " b o y "." " " ) + +while true +do + SemiRand=`date +%S` + if [ $SemiRand -eq 10 ] || [ $SemiRand -eq 45 ]; then + printf "\n" + fi + + if [ $SemiRand -eq 15 ] || [ $SemiRand -eq 35 ] || \ + [ $SemiRand -eq 36 ] || [ $SemiRand -eq 37 ]; then + printf "\n\n\t" + fi + + for i in "${Text[@]}" + do + sleep 0.05 + printf "$i" + done +done + +exit 0