简体   繁体   中英

How to use return value of one program as input for another?

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?

Try this:

bigNumber
echo $? | factors

Most Unix/Linux shells make the exit value available in the variable $? .

The error code returned by the last executed program is available in the $? shell variable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM