see my following code, i want to save the output of "java .." to a variable in the kshell:
echo $(java -version) | read appMsg
but it don't work, who can give me some suggestions, thanks in advance.
This topic has been locked.
1 reply Latest Post - 2006-01-18T21:19:02Z by ishields
Pinned topic how to save java output to kshell variable
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2006-01-18T21:19:02Z at 2006-01-18T21:19:02Z by ishields
ishields 2000001P5B3 PostsACCEPTED ANSWER
Re: how to save java output to kshell variable2006-01-18T21:19:02Z in response to zbcTry:
code$ appMsg=$(/opt/IBMJava2-142/jre/bin/java -version 2>&1)
$ echo $appMsg
java version "1.4.2" Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.2) Classic VM (build 1.4.2, J2RE 1.4.2 IBM build cxia32142sr1a-20050209 (JIT
Note that the output is provided on stderr, hence the 2>&1.