File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

save java output to a kshell variable

 
zb cong
Ranch Hand
Posts: 416
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 139
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
appMsg=`java -version`
echo $appMsg
 
zb cong
Ranch Hand
Posts: 416
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your answer, but it still don't works, if change to following, it works

appMsg=$(java -version 2>&1)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic