This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: save java output to a kshell variable
 
Similar Threads
Ksh script
startup.bat stops itself
[java] Java Result: 1 error
jre compiling error
JBOSS is not working