-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunhinged.sh
57 lines (52 loc) · 878 Bytes
/
unhinged.sh
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
#! /bin/bash
process() {
for word in $REPLY
do
let c=$((c + 1))
wc="$(echo $REPLY | wc -w)"
if [[ $BASH_VERSINFO < 4 ]]
then
uword="$(echo $word | tr '[a-z]' '[A-Z]')"
else
uword="${word^^}"
fi
if [[ $uword == $word || $word =~ ^[0-9] ]]
then
printf "$word "
else
r="$((1 + RANDOM % 100))"
if [[ $r -lt 9 ]]
then
r1="$((1 + RANDOM % 100))"
if [[ $r1 -lt 20 ]]
then
e="!"
else
e=""
fi
if [[ $sw -eq 1 || $word =~ ^\" ]]
then
printf "$uword$e "
sw=0
else
printf "\"$word$e\" "
sw=1
fi
else
printf "$word "
fi
fi
if [[ $c -eq $wc ]]
then
printf "\n\n"
fi
done
let c=0
}
let c=0
while read
do
process
done
process
exit 0