It has not been answered and that is the very reason I opened the new thread. I want them to be stored in variables which is the addressed in the previous thread. Kindly help.
Why don't you help yourself? That would be very educational! All pieces of the puzzle (parts of the solution) are given in that previous thread, you just need to get your ducks in a row.
Well, honouring your little effort, I'll try my best. That is not so easy - your wishes and specifications change form post to post and from thread to thread. Pulling some info together from the various sources, and given the fact that I can't duplicate your ps output so I use a file input, I've come up with
echo $java_home yeilds "-Djava.security.policy=" instead of "/opt/jdk150_07/bin/IA64N/java"
The best string to grep for the correct java could be to grep using keyword "bin" and "/java".
Also, when i copy paste it in my main script, i get the below error.
./master_script.sh[27]: Syntax error at line 78 : `=~' is not expected.
for t in $o
do
if echo "$t" | grep -q "/java"
then
java_home="$t"
fi
if echo "$t" | grep -q "\-Dplatform\.home"
then
weblogic_home="${t#-Dplatform.home=}"
fi
done
OR
for t in $o
do
$( echo "$t" | grep -q "/java" ) && java_home="$t"
$( echo "$t" | grep -q "\-Dplatform\.home" ) && weblogic_home="${t#-Dplatform.home=}"
done