Hi All,
I am comparing two strings inside an if condition if the strings are same then it should go inside the loop else it should execute code given in else part.
But there is a but inside my script
Even if the if condition is true
it is not going inside the loop also it is executing the else part.
Please advice
My code:
jvm=`cat /tmp/highcpu | awk -F" " '{print $3}' | sed 's/Cl/\/Cl/g' | head -1`
cd /logs/$jvm
thread1=$( cat websphere_stdout.txt | sed -n "/`cat /tmp/thrd_id | head -1`/p" | awk -F" " '{print $4}' |sed -e 's/tid=//g' -e 's/0x//g' )
thread2=$( cat /tmp/thrd_id | head -1| sed 's/0x//g' )
echo "$thread1"
echo "$thread2"
if [ "$thread1" = "$thread2" ] ; then
echo "Thread location is $jvm and thread id is `cat /tmp/thrd_id | head -1` >> /tmp/thread_causing_problem
cat websphere_stdout.txt |sed -n "/`cat /tmp/thrd_id | head -1`/,/\"/p" >> /tmp/thread_causing_problem
else
echo "Thread location is $jvm and thread id is `cat /tmp/thrd_id | head -2 | tail -1` >> /tmp/thread_causing_problem
cat websphere_stdout.txt |sed -n "/`cat /tmp/thrd_id | head -2 | tail -1`/,/\"/p" >> /tmp/thread_causing_problem
fi
Please advice where i am going wrong?
Thanks