jQuery in Action, 2nd edition*
The moose likes Linux / UNIX and the fly likes save java output to a kshell variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "save java output to a kshell variable" Watch "save java output to a kshell variable" New topic
Author

save java output to a kshell variable

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
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.
Mahesh Rana
Ranch Hand

Joined: Sep 05, 2001
Posts: 139
appMsg=`java -version`
echo $appMsg


SCJP2
zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
thanks for your answer, but it still don't works, if change to following, it works

appMsg=$(java -version 2>&1)
 
wood burning stoves
 
subject: save java output to a kshell variable