Reputation: 3158
I know that I can use pipes to set the output stream of one program to input for another:
bigNumber | factors
But what if I want to simply feed the returned value from bigNumber
's main function as factors
's input rather than what bigNumber
echos to the output stream?
Upvotes: 2
Views: 68
Reputation: 153
The error code returned by the last executed program is available in the $? shell variable
Upvotes: 1
Reputation: 57794
Try this:
bigNumber
echo $? | factors
Most Unix/Linux shells make the exit value available in the variable $?
.
Upvotes: 2