forked from frabits/frabit-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_common.sh
67 lines (59 loc) · 1.68 KB
/
ft_common.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
57
58
59
60
61
62
63
64
65
66
67
#! /bin/bash
# (c) 2022 frabit-toolkit Project maintained and limited by Blylei < blylei.info@gmail.com >
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# This toolkit is part of frabit-toolkit used for Oracle MySQL and Percona server
#
about_toolkits(){
# 展示项目信息
local VERSION='2.0.1'
local proj_url='https://github.com/frabitech/frabit-toolkit'
echo "(c) 2022 frabit-toolkit Project maintained and limited by Blylei < blylei.info@gmail.com >
GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
This toolkit is part of frabit-toolkit used for Oracle MySQL and Percona server
GitHub: $proj_url
Version: $VERSION
"
}
error() {
local lineno=$1
shift
if [[ -n "$lineno" ]]; then
printf "${BD}ERROR${NBD} (line:$lineno) : ${*//%/%%}\n" 1>&2
else
printf "${BD}ERROR${NBD} : ${*//%/%%}\n" 1>&2
fi
}
warning() {
local lineno=$1
shift
if [[ -n "$lineno" ]]; then
printf "${BD}WARNING${NBD} (line:$lineno) : ${*//%/%%}\n" 1>&2
else
printf "${BD}WARNING${NBD}: ${*//%/%%}\n" 1>&2
fi
}
info() {
if [[ $DEBUG -eq 1 ]]; then
local lineno=$1
shift
if [[ -n "$lineno" ]]; then
printf "${RED}${BD}info (line:$lineno) : ${*//%/%%}${NBD}${NRED}\n" 1>&2
else
printf "${RED}info: ${*//%/%%}${NRED}\n" 1>&2
fi
fi
}
debug() {
if [[ $DEBUG -eq 1 ]]; then
local lineno=$1
shift
if [[ -n "$lineno" ]]; then
printf "${RED}${BD}debug (line:$lineno) : ${*//%/%%}${NBD}${NRED}\n" 1>&2
else
printf "${RED}debug: ${*//%/%%}${NRED}\n" 1>&2
fi
fi
}
# 将安全系数较高的选项以环境变量的形式提供
export VARIABLE="test"