diff --git a/bin/echo-args b/bin/echo-args index a0407511..6bb2f661 100755 --- a/bin/echo-args +++ b/bin/echo-args @@ -9,9 +9,7 @@ readonly ec=$'\033' # escape char readonly eend=$'\033[0m' # escape end echoArg() { - local index=$1 - local count=$2 - local value=$3 + local index="$1" count="$2" value="$3" # if stdout is console, turn on color output. [ -t 1 ] && diff --git a/bin/find-in-jars b/bin/find-in-jars index ec655779..83e6ebe1 100755 --- a/bin/find-in-jars +++ b/bin/find-in-jars @@ -233,8 +233,7 @@ readonly total_count="$(echo $(echo "$jar_files" | wc -l))" findInJarFiles() { $is_console && local -r grep_color_option='--color=always' - local counter=1 - local jar_file + local counter=1 jar_file while read jar_file; do printResponsiveMessage "finding in jar($((counter++))/$total_count): $jar_file" diff --git a/bin/show-busy-java-threads b/bin/show-busy-java-threads index 3d94153f..ffc2394c 100755 --- a/bin/show-busy-java-threads +++ b/bin/show-busy-java-threads @@ -353,14 +353,10 @@ __complete_pid_user_by_ps() { echo "$ps_out" | logAndCat "${ps_cmd_line[@]}" > "${store_file_prefix}$(( i + 1 ))_ps" fi - local idx=0 - local -a line - while IFS=" " read -a line ; do + local idx=0 threadId pcpu + while read threadId pcpu ; do (( idx < count )) || break - local threadId="${line[0]}" - local pcpu="${line[1]}" - # output field: pid, threadId, pcpu, user local output_fields="$( echo "$ps_out" | awk -v "threadId=$threadId" -v "pcpu=$pcpu" '$2==threadId { @@ -379,14 +375,9 @@ findBusyJavaThreadsByTop() { } printStackOfThreads() { - local -a line - local idx=0 - while IFS=" " read -a line ; do - local pid="${line[0]}" - local threadId="${line[1]}" + local idx=0 pid threadId pcpu user + while read pid threadId pcpu user ; do local threadId0x="0x`printf %x ${threadId}`" - local pcpu="${line[2]}" - local user="${line[3]}" (( idx++ )) local jstackFile="${store_file_prefix}$(( i + 1 ))_jstack_${pid}"