File tree Expand file tree Collapse file tree 9 files changed +26
-28
lines changed
Expand file tree Collapse file tree 9 files changed +26
-28
lines changed Original file line number Diff line number Diff line change @@ -78,9 +78,9 @@ usage() {
7878
7979 # NOTE: $'foo' is the escape sequence syntax of bash
8080 local nl=$' \n ' # new line
81- (( $# > 0 )) && redPrint " $* $nl " > $out
81+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
8282
83- cat > $out << EOF
83+ cat > " $out " << EOF
8484Usage: ${PROG} [OPTION]... [FILE]...
8585convert to Absolute Path.
8686
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ usage() {
5151 # shellcheck disable=SC2015
5252 [ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
5353
54- (( $# > 0 )) && printErrorMsg " $* " > $out
54+ (( $# > 0 )) && printErrorMsg " $* " > " $out "
5555
56- cat > $out << EOF
56+ cat > " $out " << EOF
5757Usage: ${PROG} [OPTION]... [command [command_args ...]]
5858Run command and put output to system clipper.
5959If no command is specified, read from stdin(pipe).
Original file line number Diff line number Diff line change @@ -71,9 +71,9 @@ usage() {
7171
7272 # NOTE: $'foo' is the escape sequence syntax of bash
7373 local nl=$' \n ' # new line
74- (( $# > 0 )) && redPrint " $* $nl " > $out
74+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
7575
76- cat > $out << EOF
76+ cat > " $out " << EOF
7777Usage: ${PROG} [OPTION]... command [command-args]...
7878
7979Copy the command into docker container
Original file line number Diff line number Diff line change @@ -100,9 +100,9 @@ usage() {
100100
101101 # NOTE: $'foo' is the escape sequence syntax of bash
102102 local -r nl=$' \n ' # new line
103- (( $# > 0 )) && redPrint " $* $nl " > $out
103+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
104104
105- cat > $out << EOF
105+ cat > " $out " << EOF
106106Usage: ${PROG} [OPTION]... PATTERN
107107
108108Find files in the jar files under specified directory,
@@ -376,7 +376,7 @@ __outputResultOfJarFile() {
376376 matched=true
377377 fi
378378
379- if [ $print_matched_files != $matched ]; then
379+ if [ " $print_matched_files " != " $matched " ]; then
380380 return
381381 fi
382382
Original file line number Diff line number Diff line change @@ -76,9 +76,9 @@ usage() {
7676
7777 # NOTE: $'foo' is the escape sequence syntax of bash
7878 local nl=$' \n ' # new line
79- (( $# > 0 )) && redPrint " $* $nl " > $out
79+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
8080
81- cat > $out << EOF
81+ cat > " $out " << EOF
8282Usage: ${PROG} [OPTION]... [FILE]...
8383convert to Relative Path.
8484
Original file line number Diff line number Diff line change @@ -49,9 +49,7 @@ readonly USER
4949# ###############################################################################
5050
5151# 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
5553
5654colorPrint () {
5755 local color=$1
@@ -154,9 +152,9 @@ usage() {
154152 # shellcheck disable=SC2015
155153 [ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
156154
157- (( $# > 0 )) && colorPrint 31 " $* $nl " > $out
155+ (( $# > 0 )) && colorPrint 31 " $* $nl " > " $out "
158156
159- cat > $out << EOF
157+ cat > " $out " << EOF
160158Usage: ${PROG} [OPTION]... [delay [count]]
161159Find out the highest cpu consumed threads of java processes,
162160and print the stack of these threads.
Original file line number Diff line number Diff line change @@ -90,9 +90,9 @@ usage() {
9090 # shellcheck disable=SC2015
9191 [ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
9292
93- (( $# > 0 )) && redPrint " $* $nl " > $out
93+ (( $# > 0 )) && redPrint " $* $nl " > " $out "
9494
95- cat > $out << EOF
95+ cat > " $out " << EOF
9696Usage: ${PROG} [OPTION]... [INPUT [OUTPUT]]
9797Filter lines from INPUT (or standard input), writing to OUTPUT (or standard output).
9898Same as \` uniq\` command in core utils,
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ usage() {
4040 # shellcheck disable=SC2015
4141 [ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
4242
43- (( $# > 0 )) && printf ' %s\n\n' " $* " > $out
43+ (( $# > 0 )) && printf ' %s\n\n' " $* " > " $out "
4444
4545 cat << EOF
4646Usage: ${PROG} [OPTION] [FILE]...
Original file line number Diff line number Diff line change @@ -72,21 +72,21 @@ colorEchoWithoutNewLine() {
7272
7373 echo ' Code sample to print color text:'
7474
75- echo -n ' echo -e "\033['
75+ printf %s ' echo -e "\033['
7676 colorEchoWithoutNewLine ' 3;35;40' ' 1;36;41'
77- echo -n m
77+ printf %s m
7878 colorEchoWithoutNewLine ' 0;32;40' ' Sample Text'
79- echo ' \033[0m"'
79+ printf ' %s\n ' ' \033[0m"'
8080
81- echo -n " echo \$ '\033["
81+ printf %s " echo \$ '\033["
8282 colorEchoWithoutNewLine ' 3;35;40' ' 1;36;41'
83- echo -n " m'\" "
83+ printf %s " m'\" "
8484 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"
8787
88- echo ' Output of above code:'
89- echo -n ' '
88+ printf ' %s\n ' ' Output of above code:'
89+ printf %s ' '
9090 colorEcho ' 1;36;41' ' Sample Text'
9191 echo
9292 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