• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

how to get output string parameter from Java to shell script

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Does anyone know how to get output string parameter from Java to shell script. which means when shell script execute a java with input string parameter(20 bytes) and Java program return an output string parameter.

is that possible to return a string to sell script?
if so, how java can return and how to retrieve this string output value from shell script progtam.

welcome any opinion,

thanks,
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not really a String per se, but you can get at the output stream of the script process; that's pretty close to being the same thing. See here for hints on how to proceed.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand the question the other way round, Ulf.

Sending 20 bytes to Java can be done in two ways: As inputstream or by arguments.

Method 1:


call it:


grab the output in the shell:


Using a parameter works this way:


and is called

simply using

will not work, since date responds with
Sa 15 Dez 21:14:37 CET 2007
which is 6 Strings (seperated by whitespace).
Masking them with "..." glues them together with blanks inside.
If your bytes aren't printable, it might be useful as well to mask them.

grab the output in the shell:
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic