2 echo Params
: "$#" - \
("$1"\
) \
("$2"\
) \
("$3"\
) \
("$4"\
)
5 echo "Command takes exactly 4 params - Jar_name_pattern search_location file_name_pattern search_string
6 Use - for Jar_name_pattern to search for within all jars.
7 Use - for search_file_name to find with file_name_pattern only and avoid content search"
23 echo Executing
: find "$2" -name "$jar_param"
24 file_list
=`find "$2" -name "$jar_param"`
27 mkdir search_file || rw_not
=1
30 echo "/tmp/ is not writeable by current user thus can search file content and exiting"
35 for jar_file
in $file_list
37 inner_file_list
=`jar tf "$jar_file" | grep "$3"`
38 if test "$search_content" = "0"
40 if test -n "$inner_file_list"
42 jar xf
"$jar_file" $inner_file_list
43 for inner_file
in $inner_file_list
45 has_content
=`cat $inner_file | grep "$4"`
46 if test -n "$has_content"
48 echo Found
in "$inner_file" @
"$jar_file"
54 test -n "$inner_file_list" && echo "$jar_file"