Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

According to the Wikipedia article on standard streams, The keyboard is connected to a program via standard input. I'm assuming the program refers to a shell, which interprets the commands inputted by the keyboard. My question: How are my inputs displayed on screen if they redirected to a program? Hopefully you can correct me for any misunderstanding I may have.

share|improve this question
    
Could you please elaborate on how you see it now? I don't get what part you don't understand. –  gronostaj Jun 27 '13 at 18:56

1 Answer 1

up vote 2 down vote accepted

Your inputs are displayed to you by the terminal / program / operating system / host. If it is configured not to do so, you will see nothing on your screen.

http://en.wikipedia.org/wiki/Echo_(computing) is probably the lecture you want next.

share|improve this answer
    
It seems that a terminal would perform a local echo to its display! I think this is exactly what I was looking for! Thank you. –  mngo Jun 27 '13 at 18:48
    
If you deem the answer to be correct, please don't forget to accept it. meta.stackexchange.com/questions/5234/… –  Squeezy Jun 27 '13 at 18:57
    
There are 3 main file descriptors (streams) standard in, standard out, and standard error. The program will write to one of these descriptors. without any redirection, your terminal will display any of these to the screen. I'd visit en.wikipedia.org/wiki/Standard_streams before echo personally. –  Gregg Leventhal Jun 27 '13 at 19:50
    
I reread your question and see you came from there already. The answer is that the program would use C library functions which are essentially wrappers for system calls which would write to the respective file descriptor (0,1,2) and thusly the stream which would show up in your terminal. –  Gregg Leventhal Jun 27 '13 at 19:57
    
echo ultimately uses the write system call. See this trace of the command "echo helloThere!" write(1, "helloThere!\n", 12helloThere! ) Which uses the file descriptor 1 (standard output stream to write the 12 byte string to my terminal, followed by a newline. –  Gregg Leventhal Jun 27 '13 at 20:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.