Debian Codegraph @

homework.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # homework.sh: All-purpose homework assignment solution.
3 # Author: M. Leo Cooper
4 # If you substitute your own name as author, then it is plagiarism,
5 #+ possibly a lesser sin than cheating on your homework!
6 # License: Public Domain
7
8 # This script may be turned in to your instructor
9 #+ in fulfillment of ALL shell scripting homework assignments.
10 # It's sparsely commented, but you, the student, can easily remedy that.
11 # The script author repudiates all responsibility!
12
13 DLA=1
14 P1=2
15 P2=4
16 P3=7
17 PP1=0
18 PP2=8
19 MAXL=9
20 E_LZY=99
21
22 declare -a L
23 L[0]="3 4 0 17 29 8 13 18 19 17 20 2 19 14 17 28"
24 L[1]="8 29 12 14 18 19 29 4 12 15 7 0 19 8 2 0 11 11 24 29 17 4 6 17 4 19"
25 L[2]="29 19 7 0 19 29 8 29 7 0 21 4 29 13 4 6 11 4 2 19 4 3"
26 L[3]="19 14 29 2 14 12 15 11 4 19 4 29 19 7 8 18 29"
27 L[4]="18 2 7 14 14 11 22 14 17 10 29 0 18 18 8 6 13 12 4 13 19 26"
28 L[5]="15 11 4 0 18 4 29 0 2 2 4 15 19 29 12 24 29 7 20 12 1 11 4 29"
29 L[6]="4 23 2 20 18 4 29 14 5 29 4 6 17 4 6 8 14 20 18 29"
30 L[7]="11 0 25 8 13 4 18 18 27"
31 L[8]="0 13 3 29 6 17 0 3 4 29 12 4 29 0 2 2 14 17 3 8 13 6 11 24 26"
32 L[9]="19 7 0 13 10 29 24 14 20 26"
33
34 declare -a \
35 alph=( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z . , : ' ' )
36
37
38 pt_ltscip-shell shell abs-guide 10-4 pt_lt(). ()
39 {
40 echoscip-shell system . . echo. -n "${alph[$1]}"
41 echoscip-shell system . . echo. -n -e "\a"
42 sleepscip-shell system . . sleep. $DLA
43 }
44
45 b_rscip-shell shell abs-guide 10-4 b_r(). ()
46 {
47 echoscip-shell system . . echo. -e '\E[31;48m\033[1m'
48 }
49
50 crscip-shell shell abs-guide 10-4 cr(). ()
51 {
52 echoscip-shell system . . echo. -e "\a"
53 sleepscip-shell system . . sleep. $DLA
54 }
55
56 restorescip-shell shell abs-guide 10-4 restore(). ()
57 {
58 echoscip-shell system . . echo. -e '\033[0m' # Bold off.
59 tputscip-shell system . . tput. sgr0 # Normal.
60 }
61
62
63 p_lscip-shell shell abs-guide 10-4 p_l(). ()
64 {
65 for ltr in $1
66 do
67 pt_ltscip-shell shell abs-guide 10-4 pt_lt(). "$ltr"
68 done
69 }
70
71 # ----------------------
72 b_rscip-shell shell abs-guide 10-4 b_r().
73
74 for i in $(seqscip-shell system . . seq. 0 $MAXL)
75 do
76 p_lscip-shell shell abs-guide 10-4 p_l(). "${L[i]}"
77 if [[ "$i" -eq "$P1" || "$i" -eq "$P2" || "$i" -eq "$P3" ]]
78 then
79 crscip-shell shell abs-guide 10-4 cr().
80 elif [[ "$i" -eq "$PP1" || "$i" -eq "$PP2" ]]
81 then
82 crscip-shell shell abs-guide 10-4 cr().; crscip-shell shell abs-guide 10-4 cr().
83 fi
84 done
85
86 restorescip-shell shell abs-guide 10-4 restore().
87 # ----------------------
88
89 echoscip-shell system . . echo.
90
91 exit $E_LZY
92
93 # A typical example of an obfuscated script that is difficult
94 #+ to understand, and frustrating to maintain.
95 # In your career as a sysadmin, you'll run into these critters
96 #+ all too often.