File tree 9 files changed +26
-28
lines changed
9 files changed +26
-28
lines changed Original file line number Diff line number Diff line change @@ -78,9 +78,9 @@ usage() {
78
78
79
79
# NOTE: $'foo' is the escape sequence syntax of bash
80
80
local nl=$' \n ' # new line
81
- (( $# > 0 )) && redPrint " $* $nl " > $out
81
+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
82
82
83
- cat > $out << EOF
83
+ cat > " $out " << EOF
84
84
Usage: ${PROG} [OPTION]... [FILE]...
85
85
convert to Absolute Path.
86
86
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ usage() {
51
51
# shellcheck disable=SC2015
52
52
[ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
53
53
54
- (( $# > 0 )) && printErrorMsg " $* " > $out
54
+ (( $# > 0 )) && printErrorMsg " $* " > " $out "
55
55
56
- cat > $out << EOF
56
+ cat > " $out " << EOF
57
57
Usage: ${PROG} [OPTION]... [command [command_args ...]]
58
58
Run command and put output to system clipper.
59
59
If no command is specified, read from stdin(pipe).
Original file line number Diff line number Diff line change @@ -71,9 +71,9 @@ usage() {
71
71
72
72
# NOTE: $'foo' is the escape sequence syntax of bash
73
73
local nl=$' \n ' # new line
74
- (( $# > 0 )) && redPrint " $* $nl " > $out
74
+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
75
75
76
- cat > $out << EOF
76
+ cat > " $out " << EOF
77
77
Usage: ${PROG} [OPTION]... command [command-args]...
78
78
79
79
Copy the command into docker container
Original file line number Diff line number Diff line change @@ -100,9 +100,9 @@ usage() {
100
100
101
101
# NOTE: $'foo' is the escape sequence syntax of bash
102
102
local -r nl=$' \n ' # new line
103
- (( $# > 0 )) && redPrint " $* $nl " > $out
103
+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
104
104
105
- cat > $out << EOF
105
+ cat > " $out " << EOF
106
106
Usage: ${PROG} [OPTION]... PATTERN
107
107
108
108
Find files in the jar files under specified directory,
@@ -376,7 +376,7 @@ __outputResultOfJarFile() {
376
376
matched=true
377
377
fi
378
378
379
- if [ $print_matched_files != $matched ]; then
379
+ if [ " $print_matched_files " != " $matched " ]; then
380
380
return
381
381
fi
382
382
Original file line number Diff line number Diff line change @@ -76,9 +76,9 @@ usage() {
76
76
77
77
# NOTE: $'foo' is the escape sequence syntax of bash
78
78
local nl=$' \n ' # new line
79
- (( $# > 0 )) && redPrint " $* $nl " > $out
79
+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
80
80
81
- cat > $out << EOF
81
+ cat > " $out " << EOF
82
82
Usage: ${PROG} [OPTION]... [FILE]...
83
83
convert to Relative Path.
84
84
Original file line number Diff line number Diff line change @@ -49,9 +49,7 @@ readonly USER
49
49
# ###############################################################################
50
50
51
51
# NOTE: $'foo' is the escape sequence syntax of bash
52
- readonly ec=$' \033 ' # escape char
53
- readonly eend=$' \033 [0m' # escape end
54
- readonly nl=$' \n ' # new line
52
+ readonly nl=$' \n ' # new line
55
53
56
54
colorPrint () {
57
55
local color=$1
@@ -154,9 +152,9 @@ usage() {
154
152
# shellcheck disable=SC2015
155
153
[ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
156
154
157
- (( $# > 0 )) && colorPrint 31 " $* $nl " > $out
155
+ (( $# > 0 )) && colorPrint 31 " $* $nl " > " $out "
158
156
159
- cat > $out << EOF
157
+ cat > " $out " << EOF
160
158
Usage: ${PROG} [OPTION]... [delay [count]]
161
159
Find out the highest cpu consumed threads of java processes,
162
160
and print the stack of these threads.
Original file line number Diff line number Diff line change @@ -90,9 +90,9 @@ usage() {
90
90
# shellcheck disable=SC2015
91
91
[ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
92
92
93
- (( $# > 0 )) && redPrint " $* $nl " > $out
93
+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
94
94
95
- cat > $out << EOF
95
+ cat > " $out " << EOF
96
96
Usage: ${PROG} [OPTION]... [INPUT [OUTPUT]]
97
97
Filter lines from INPUT (or standard input), writing to OUTPUT (or standard output).
98
98
Same as \` uniq\` command in core utils,
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ usage() {
40
40
# shellcheck disable=SC2015
41
41
[ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
42
42
43
- (( $# > 0 )) && printf ' %s\n\n' " $* " > $out
43
+ (( $# > 0 )) && printf ' %s\n\n' " $* " > " $out "
44
44
45
45
cat << EOF
46
46
Usage: ${PROG} [OPTION] [FILE]...
Original file line number Diff line number Diff line change @@ -72,21 +72,21 @@ colorEchoWithoutNewLine() {
72
72
73
73
echo ' Code sample to print color text:'
74
74
75
- echo -n ' echo -e "\033['
75
+ printf %s ' echo -e "\033['
76
76
colorEchoWithoutNewLine ' 3;35;40' ' 1;36;41'
77
- echo -n m
77
+ printf %s m
78
78
colorEchoWithoutNewLine ' 0;32;40' ' Sample Text'
79
- echo ' \033[0m"'
79
+ printf ' %s\n ' ' \033[0m"'
80
80
81
- echo -n " echo \$ '\033["
81
+ printf %s " echo \$ '\033["
82
82
colorEchoWithoutNewLine ' 3;35;40' ' 1;36;41'
83
- echo -n " m'\" "
83
+ printf %s " m'\" "
84
84
colorEchoWithoutNewLine ' 0;32;40' ' Sample Text'
85
- echo " \" $'\033[0m'"
86
- echo " # NOTE: $'foo' is the escape sequence syntax of bash, safer escape"
85
+ printf ' %s\n ' " \" $'\033[0m'"
86
+ printf ' %s\n ' " # NOTE: $'foo' is the escape sequence syntax of bash, safer escape"
87
87
88
- echo ' Output of above code:'
89
- echo -n ' '
88
+ printf ' %s\n ' ' Output of above code:'
89
+ printf %s ' '
90
90
colorEcho ' 1;36;41' ' Sample Text'
91
91
echo
92
92
echo ' If you are going crazy to write text in escapes string like me,'
You can’t perform that action at this time.
0 commit comments