Gjort övning 3, script 2 till labb 4 och ett The Shining script

This commit is contained in:
Jack-Benny Persson 2013-12-13 15:46:44 +01:00
parent 6306cbb6fc
commit 9283ee5940
2 changed files with 43 additions and 0 deletions

View File

@ -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

29
jack.sh Executable file
View File

@ -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