@@ -16,6 +16,8 @@ readonly PROG="`basename "$0"`"
16
16
usage () {
17
17
[ -n " $1 " -a " $1 " != 0 ] && local out=/dev/stderr || local out=/dev/stdout
18
18
19
+ [ $# -gt 1 ] && { echo " $2 " ; echo ; } > $out
20
+
19
21
> $out cat << EOF
20
22
Usage: ${PROG} [OPTION]... PATTERN
21
23
Find file in the jar files under specified directory(recursive, include subdirectory).
@@ -25,7 +27,7 @@ Example:
25
27
${PROG} 'log4j\.properties'
26
28
${PROG} '^log4j\.(properties|xml)$' # search file log4j.properties/log4j.xml at zip root
27
29
${PROG} 'log4j\.properties$' -d /path/to/find/directory
28
- ${PROG} 'log4j\.properties' -d /path/to/find/dir1 -d / path/to/find/dir2
30
+ ${PROG} 'log4j\.properties' -d /path/to/find/dir1 -d path/to/find/dir2
29
31
${PROG} 'log4j\.properties' -e jar -e zip
30
32
${PROG} 'log4j\.properties' -s ' <-> '
31
33
@@ -106,9 +108,7 @@ while [ $# -gt 0 ]; do
106
108
break
107
109
;;
108
110
-* )
109
- echo " ${PROG} : unrecognized option '$1 '" 1>&2
110
- echo 1>&2
111
- usage 2;
111
+ usage 2 " ${PROG} : unrecognized option '$1 '"
112
112
;;
113
113
* )
114
114
args=(" ${args[@]} " " $1 " )
@@ -120,8 +120,8 @@ dirs=${dirs:-.}
120
120
extension=${extension:- jar}
121
121
seperator=" ${seperator:-! } "
122
122
123
- [ " ${# args[@]} " -eq 0 ] && { echo " No find file pattern!" 1>&2 ; usage 1 ; }
124
- [ " ${# args[@]} " -gt 1 ] && { echo " More than 1 file pattern!" 1>&2 ; usage 1 ; }
123
+ [ " ${# args[@]} " -eq 0 ] && usage 1 " No find file pattern!"
124
+ [ " ${# args[@]} " -gt 1 ] && usage 1 " More than 1 file pattern!"
125
125
readonly pattern=" ${args[0]} "
126
126
127
127
# convert dirs to Absolute Path.
0 commit comments