return value

idan72 ishai at cisco.com
Wed Nov 19 13:33:43 PST 2008


Hi,

Suppose I have the following code in my shell :

java  classA.run -param1 5 -param2 10
export reqId=$?
java  classB.run -reqId $reqId

How do I use pipe in this case ?

Thanks



David A. Bandel-2 wrote:
> 
> On Tue, Nov 18, 2008 at 4:16 PM, idan72 <ishai at cisco.com> wrote:
>>
>> Hi,
>>
>> I am running from the shell several java program and I need to send for
>> program 2 the value return from program 1. The value isn't error code but
>> a
>> value compute in first program and used in second.
>>
>> Is there other way to do that beside using file ?
> 
> Yes, pipes.  You can use a named pipe if you want.  Program 2 looks
> for anything coming through the pipe.  Program 1 sends data to the
> pipe (although technically, a named pipe is a "file" it is not a
> storage container).
> 
>>
>> Thanks
>>
>> David A. Bandel-2 wrote:
>>>
>>> On Tue, Nov 18, 2008 at 6:16 AM, idan72 <ishai at cisco.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am running java program from batch file on linux.
>>>> I want to get the return value using $? .
>>>> If the value is less than 256 there is no problem.If it greater it
>>>> return
>>>> only the byte (257-> 1, ...) .
>>>>
>>>> How can I overcome this issue that the return value is only a byte ?
>>>
>>> rewrite bash? write your own shell?
>>>
>>> normal exit status is 0 (success), 1 (failure), 126 (file found but
>>> not executable), 127 (file not found).  Other exit status' are thrown
>>> to help programmers trap errors (exit 2, etc).  And 127+n is available
>>> (but only up to 255).  Just how many errors are you trying to trap
>>> anyway?  Sounds like you're trying to use exit status for something it
>>> wasn't designed for.
>>>
>>> Ciao,
>>>
>>> David A. Bandel
>>> --
>>> Focus on the dream, not the competition.
>>>             - Nemesis Air Racing Team motto
>>> _______________________________________________
>>> Linux-users mailing list ( Linux-users at linux-sxs.org )
>>> Unsub/Password/Etc:
>>> http://linux-sxs.org/mailman/listinfo/linux-users
>>>
>>> Need to chat further on this subject? Check out #linux-users on
>>> irc.linux-sxs.org !
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/return-value-tp20557620p20568382.html
>> Sent from the Linux Users (linux-sxs.org) mailing list archive at
>> Nabble.com.
>>
>> _______________________________________________
>> Linux-users mailing list ( Linux-users at linux-sxs.org )
>> Unsub/Password/Etc:
>> http://linux-sxs.org/mailman/listinfo/linux-users
>>
>> Need to chat further on this subject? Check out #linux-users on
>> irc.linux-sxs.org !
>>
> 
> 
> David A. Bandel
> -- 
> Focus on the dream, not the competition.
>             - Nemesis Air Racing Team motto
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc: 
> http://linux-sxs.org/mailman/listinfo/linux-users
> 
> Need to chat further on this subject? Check out #linux-users on
> irc.linux-sxs.org !
> 
> 

-- 
View this message in context: http://www.nabble.com/return-value-tp20557620p20575119.html
Sent from the Linux Users (linux-sxs.org) mailing list archive at Nabble.com.




More information about the Linux-users mailing list