Jump to content

How to use STDIN and STDOUT in linux?

babadoctor
Go to solution Solved by igormp,

Simply put, when you're running a program from the command line, anything that it spits out into your terminal is the content it wrote to STDOUT. Whatever you input into your terminal is the STDIN.

 

You can pass the STDOUT content of one program into the STDIN of another through pipes (represented by the operator | ), you can read more about it here.

One example would be: 

echo hi | base64

Where "echo hi" would write something to the STDOUT, but, since we're using a pipe, it's actually being redirected as the STDIN to base64, which reads and and spits out the string "hi" as a base64 encoded string.

I want to use STDOUT from this program called streamlink and send it to the STDIN of another program that uploads files to internet archive.

 

How do you typically accomplish this?

 

Does it involve asynchronous code?

 

The help page for streamlink says it supports STDOUT

https://streamlink.github.io/cli.html#cmdoption-stdout

And the help page for internet archive says it supports stdin

https://archive.org/services/docs/api/internetarchive/cli.html

 

but... how do you tell it which STDIN I want to use? 

 

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

Simply put, when you're running a program from the command line, anything that it spits out into your terminal is the content it wrote to STDOUT. Whatever you input into your terminal is the STDIN.

 

You can pass the STDOUT content of one program into the STDIN of another through pipes (represented by the operator | ), you can read more about it here.

One example would be: 

echo hi | base64

Where "echo hi" would write something to the STDOUT, but, since we're using a pipe, it's actually being redirected as the STDIN to base64, which reads and and spits out the string "hi" as a base64 encoded string.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, igormp said:

Simply put, when you're running a program from the command line, anything that it spits out into your terminal is the content it wrote to STDOUT. Whatever you input into your terminal is the STDIN.

 

You can pass the STDOUT content of one program into the STDIN of another through pipes (represented by the operator | ), you can read more about it here.

One example would be: 


echo hi | base64

Where "echo hi" would write something to the STDOUT, but, since we're using a pipe, it's actually being redirected as the STDIN to base64, which reads and and spits out the string "hi" as a base64 encoded string.

Ohhhh I see.

 

Thank you!

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×