Forums Register Login

save java output to a kshell variable

+Pie Number of slices to send: Send
hello
see my following code, i want to save the output of "java .." to a variable in the kshell:

echo $(java -version) | read appMsg
echo $appMsg


but it don't work, who can give me some suggestions, thanks in advance.
+Pie Number of slices to send: Send
appMsg=`java -version`
echo $appMsg
+Pie Number of slices to send: Send
thanks for your answer, but it still don't works, if change to following, it works

appMsg=$(java -version 2>&1)
The first person to drink cow's milk. That started off as a dare from this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 841 times.
Similar Threads
startup.bat stops itself
jre compiling error
Ksh script
[java] Java Result: 1 error
JBOSS is not working
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:19:24.