-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecode
executable file
·88 lines (83 loc) · 1.01 KB
/
decode
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
#!/bin/sh
i200='🫂'
i50='💖'
i10='✨'
i5='🥺'
i1=','
i0='❤️'
bss='👉'
bse='👈'
buf() {
char="${l%"${l#?}"}"
buf="$buf$char"
case $buf in
"$i0")
printf '\0'
l="${l#?}"
sum=0
buf=''
return
# continue
;;
"$i200")
buf=
: $((sum+=200))
;;
"$i50")
buf=
: $((sum+=50))
;;
"$i10")
buf=
: $((sum+=10))
;;
"$i5")
buf=
: $((sum+=5))
;;
"$i1")
buf=
: $((sum+=1))
;;
"$bss")
printf "\\$(printf '%o' "$sum")"
sum=0
buf=
;;
"$bse")
buf=
;;
esac
l="${l#?}"
}
ch() {
for i in "$bse" "$bss" "$i0" "$i200" "$i50" "$i10" \
"$i5" "$i1"; do
[ "${l%"${l#"$i"}"}" != "$i" ] &&
continue
case $i in
"$bse") ;;
"$bss")
printf "\\$(printf '%o' "$sum")"
sum=0
;;
"$i0")
printf '\0'
sum=0
;;
"$i200") : $((sum+=200)) ;;
"$i50") : $((sum+=50)) ;;
"$i10") : $((sum+=10)) ;;
"$i5") : $((sum+=5)) ;;
"$i1") : $((sum+=1)) ;;
esac
l="${l#"$i"}"
break
done
}
sum=0
while read -r l; do
while [ -n "$l" ]; do
buf
done
done