@@ -41,7 +41,6 @@ readonly PROG_VERSION='2.6.0-dev'
4141# ###############################################################################
4242
4343readonly red=' \033[1;31m' normal=' \033[0m'
44- readonly jar_color=' \033[1;35m' sep_color=' \033[1;32m'
4544
4645# How to delete line with echo?
4746# https://unix.stackexchange.com/questions/26576
@@ -95,14 +94,13 @@ die() {
9594usage () {
9695 local -r exit_code=" ${1:- 0} "
9796 (( $# > 0 )) && shift
98- # shellcheck disable=SC2015
99- [ " $exit_code " != 0 ] && local -r out=/dev/stderr || local -r out=/dev/stdout
97+ local -r out=$(( (exit_code != 0 ) + 1 ))
10098
10199 # NOTE: $'foo' is the escape sequence syntax of bash
102100 local -r nl=$' \n ' # new line
103- (( $# > 0 )) && redPrint " $* $nl " > " $out "
101+ (( $# > 0 )) && redPrint " $* $nl " >& " $out "
104102
105- cat > " $out " << EOF
103+ cat >& " $out " << EOF
106104Usage: ${PROG} [OPTION]... PATTERN
107105
108106Find files in the jar files under specified directory,
@@ -355,10 +353,12 @@ searchJarFiles() {
355353 printf ' %s\n' " $jar_files "
356354}
357355
356+ readonly jar_color=' \033[1;35m' sep_color=' \033[1;32m'
357+
358358__outputResultOfJarFile () {
359359 local jar_file=" $1 " file
360360 # shellcheck disable=SC2206
361- local grep_opt_args=($regex_mode ${ignore_case_option:- } ${grep_color_option:- } -- " $pattern " )
361+ local grep_opt_args=(" $regex_mode " ${ignore_case_option:- } ${grep_color_option:- } -- " $pattern " )
362362
363363 if $only_print_file_name ; then
364364 local matched=false
0 commit comments