-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintro
executable file
·222 lines (204 loc) · 3.64 KB
/
intro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash
#base href = https://www.serverproject.de
#this is toodoo intro version < 1
#it is evaluation, examination, experiment and exercise
#the code is commented in english and german
#fragile || predictable
#retrieve name
var0=`basename "$0"`;
#output name
echo $var0;
#blob
URL=https://github.com/ewingson/edx-02-intro/blob/master/intro
#set tmp
tmp="temp"
#debug-mode
debug=false;
#argumentzuweisung
self[0]=$1;
self[1]=$2;
self[2]=$3;
self[3]=$4;
self[4]=$5;
#we must check if arguments are set
if [ -z "$1" ]
then
{ var1=null;
b1=false; }
else
{ var1=$1;
b1=true; }
fi
if [ -z "$2" ]
then
{ var2=null;
b2=false; }
else
{ var2=$2;
b2=true; }
fi
if [ -z "$3" ]
then
{ var3=null;
b3=false; }
else
{ var3=$3;
b3=true; }
fi
if [ -z "$4" ]
then
{ var4=null;
b4=false; }
else
{ var4=$4;
b4=true; }
fi
if [ -z "$5" ]
then
{ var5=null;
b5=false; }
else
{ var5=$5;
b5=true; }
fi
if [ -z "$6" ]
then
{ okay=true; }
else
{ okay=false; }
fi
#COUNTER (not yet used)
#count[1]=$var1;
#count[2]=$var2;
#count[3]=$var3;
#count[4]=$var4;
#count[5]=$var5;
#deprecated alternative extreme array conscience programming (rule conform)
#output and count arguments
j=0
for i in ${self[@]}; do
echo $i
j+=1
done
slength="$j"
size=${#slength}
#echo $COUNTER
#now we have all we need
#check the five boolean
if [[ "$b1" = true && "$okay" = true ]]
then flag=true
else flag=false
fi
if [ "$flag" = true ]
then
#whether exists or not output status and argument
if [ "$b1" = true ]
then
echo argument ${var1} exists
#other case
else
echo argument ${var1} does not exist
fi
if [ "$b2" = true ]
then
echo argument ${var2} exists
else
echo argument ${var2} does not exist
fi
if [ "$b3" = true ]
then
echo argument ${var3} exists
else
echo argument ${var3} does not exist
fi
if [ "$b4" = true ]
then
echo argument ${var4} exists
else
echo argument ${var4} does not exist
fi
if [ "$b5" = true ]
then
echo argument ${var5} exists
else
echo argument ${var5} does not exist
fi
else
#error message and exit if invalid number of arguments
echo "Arguments are zero or > 5"
#exit 1
exit 1
fi
#array syntax is variable[index]=$value
arrlength=$((size - 1));
#we have printf(%d total %d arguments, $size, $arrlength);
echo $size total $arrlength arguments;
#toodoo
#direction = (0 || 1 || 2038 || x203x || 4 || (5 && true))
#SI-Einheiten
#SI seconds for light to sun
sun=8*60
#SI seconds for lifetime sun
runtime=5000000000*365*24*60*60
#SI speed of light in meter/second
lightspeed=299792458
#SI distance light makes in a year in meter/year
lightyear=9460730472580800
#SI hoehe geostationaere umlaufbahn in meter
geosthoehe=35786000
#SI gravity (earth acceleration) in meter/second^2
grav=9,81
#alphabet
alphabet="abcdefghijklmnopqrstuvwxyz"
#if (variable0=true)
#{
#ping6 2a01:488:42:1000:50ed:829b:26:25dc
#}
#set debug mode
if [ ${var1} = -d ]
then
debug=true
fi
#manpageman-option
if [ ${var1} = -m ]
then
man man;
fi
#show-file/dir-option
if [ ${var1} = show ]
then
{
less ${var5};
}
fi
#delete-option
if [ ${var1} = del ]
then
{
#delete file
if [ ${var2} = fil ]
then
{
rm ${var5};
}
fi
#delete directory
if [ ${var2} = fol ]
then
{
rm -r ${var5};
}
fi
}
fi
#check argument 1 (-p option) if ping mode
if [ ${var1} = -p ]
then
#ping solidweb.org
{ ping 46.163.118.221; }
else
#output string 'normal'
{ echo normal; }
fi
#exit 0
exit 0