-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvgclean
executable file
·67 lines (59 loc) · 1.04 KB
/
svgclean
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
#!/bin/bash
# Set console color.
_c() {
tput sgr0;
if (($# < 1)); then
return;
fi;
local -A Codes=(
["black"]="0"
["red"]="1"
["green"]="2"
["yellow"]="3"
["blue"]="4"
["magenta"]="5"
["cyan"]="6"
["white"]="7"
["bk"]="0"
["r"]="1"
["g"]="2"
["y"]="3"
["bu"]="4"
["m"]="5"
["c"]="6"
["w"]="7"
);
local k c;
for k in "${!Codes[@]}"; do
if [[ "${k}" != "${1}" ]]; then
continue;
fi;
c="${Codes[$k]}";
done;
if ! [ "${c}" ]; then
return;
fi;
tput setaf "${c}";
}
# Set bold console color.
_C() {
tput bold;
if (($#<1)); then
return;
fi;
_c "${1}";
}
# Reset console color to normal.
_u() {
tput sgr0;
}
declare IMAGE;
for IMAGE; do
if ! [ -e "${IMAGE}" ]; then
_c red;
echo "${IMAGE} doesn't exist.";
_u;
continue;
fi;
svgcleaner "${IMAGE}" "${IMAGE}";
done;