File tree Expand file tree Collapse file tree 7 files changed +10
-18
lines changed Expand file tree Collapse file tree 7 files changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,12 @@ while [ $# -gt 0 ]; do
6060 break
6161 ;;
6262 -* )
63- # if unrecognized option, treat it and all follow args as args
63+ # if unrecognized option, treat it and all follow arguments as args
6464 args=(${args[@]: +" ${args[@]} " } " $@ " )
6565 break
6666 ;;
6767 * )
68- # if not option, treat all follow args as args
68+ # if not option, treat all follow arguments as args
6969 args=(${args[@]: +" ${args[@]} " } " $@ " )
7070 break
7171 ;;
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ while [ $# -gt 0 ]; do
111111 usage 2 " unrecognized option '$1 '"
112112 ;;
113113 * )
114- # if not option, treat all follow args as command
114+ # if not option, treat all follow arguments as command
115115 target_command=(${target_command[@]: +" ${target_command[@]} " } " $@ " )
116116 break
117117 ;;
Original file line number Diff line number Diff line change @@ -44,9 +44,7 @@ colorLines() {
4444 # How to use `while read` (Bash) to read the last line in a file
4545 # if there’s no newline at the end of the file?
4646 # https://stackoverflow.com/questions/4165135
47- if [ -n " $line " ]; then
48- rotateColorPrint " $line "
49- fi
47+ [ -z " $line " ] || rotateColorPrint " $line "
5048}
5149
5250if [ $# == 0 ]; then
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ while (($# > 0)); do
164164 usage 2 " $PROG : unrecognized option '$1 '"
165165 ;;
166166 * )
167- # if not option, treat all follow args as command
167+ # if not option, treat all follow arguments as command
168168 args=(${args[@]: +" ${args[@]} " } " $@ " )
169169 break
170170 ;;
Original file line number Diff line number Diff line change @@ -349,7 +349,7 @@ searchJarFiles() {
349349
350350 total_jar_count=$( printf ' %s\n' " $jar_files " | wc -l)
351351 # remove white space, because the `wc -l` output on mac contains white space!
352- total_jar_count=${total_jar_count// [[:space:]]}
352+ total_jar_count=${total_jar_count// [[:space:]]/ }
353353
354354 echo " $total_jar_count "
355355 printf ' %s\n' " $jar_files "
@@ -370,13 +370,9 @@ __outputResultOfJarFile() {
370370 # - https://stackoverflow.com/questions/19120263/why-exit-code-141-with-grep-q
371371 # - https://unix.stackexchange.com/questions/305547/broken-pipe-when-grepping-output-but-only-with-i-flag
372372 # - http://www.pixelbeat.org/programming/sigpipe_handling.html
373- if grep -c " ${grep_opt_args[@]} " & > /dev/null; then
374- matched=true
375- fi
373+ grep -c " ${grep_opt_args[@]} " & > /dev/null && matched=true
376374
377- if [ " $print_matched_files " != " $matched " ]; then
378- return
379- fi
375+ [ " $print_matched_files " != " $matched " ] && return
380376
381377 clearResponsiveMessage
382378 if [ -t 1 ]; then
Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ isNaturalNumber "$update_count" || die "update count($update_count) is not a nat
303303readonly update_count
304304
305305if [ -n " $pid_list " ]; then
306- pid_list=${pid_list// [[:space:]]} # delete white space
306+ pid_list=${pid_list// [[:space:]]/ } # delete white space
307307 isNaturalNumberList " $pid_list " || die " pid(s)($pid_list ) is illegal! example: 42 or 42,99,67"
308308fi
309309readonly pid_list
Original file line number Diff line number Diff line change @@ -44,9 +44,7 @@ colorLines() {
4444 # How to use `while read` (Bash) to read the last line in a file
4545 # if there’s no newline at the end of the file?
4646 # https://stackoverflow.com/questions/4165135
47- if [ -n " $line " ]; then
48- rotateColorPrint " $line "
49- fi
47+ [ -z " $line " ] || rotateColorPrint " $line "
5048}
5149
5250tac " $@ " | colorLines
You can’t perform that action at this time.
0 commit comments