-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuet
executable file
·47 lines (38 loc) · 1003 Bytes
/
cuet
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
#!/bin/bash
#
# @author Zeus Intuivo <[email protected]>
#
#
# if value is not set -- exit silent it
if [[ -z "$1" ]] ; then
exit 0
fi
# Escape chars / !
function escape_slashes {
sed 's/\//\\\//g'
}
function escape_quotes {
sed 's/\"/\\\"/g'
}
function escape_bangs {
sed 's/\!/\\\!/g'
}
function escape_dots {
sed 's/\./\\\./g'
}
SEEKING=$(echo """$*""" | escape_dots | escape_slashes | escape_quotes | escape_bangs)
# if everything else --
# check operation systems
(
if [[ "$(uname)" == "Darwin" ]] ; then
# Do something under Mac OS X platform
sed 's/'"""${SEEKING}"""'//g' ;
elif [[ "$(expr substr $(uname -s) 1 5)" == "Linux" ]] ; then
# Do something under GNU/Linux platform
sed 's/'"""${SEEKING}"""'//g' ;
elif [[ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]] || [[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]] ; then
# Do something under Windows NT platform
sed 's/'"""${SEEKING}"""'//g' ;
# nothing here
fi
)