Standard I/O

Now that you understand what I/O is, and how commands in Unix work with redirection, it's time to cover what standard input and output is, as well as standard error. In this section of the lesson, we will cover how Unix accepts input and output and errors by default.

When each Unix program is created, it will have a way to accept input. Unix itself is not only based on I/O, but so is every program that runs within it. Unix, when operated through the shell prompt, allows you to control I/O completely, which is why such characters can be used in shell scripts, which will be covered in Lesson 14, “Shell Scripting Fundamentals.” In the last lesson we learned how to use cron to automate, and it could automate a script. Think of the shell prompt commands and processes we have learned. It should be clear to you that if you master what we have learned, and shell scripting, the power of Unix dwarfs its competitors. Unix is flexible in just about every way imaginable. One of the things you can do with I/O management is redirect input from any standard location to anything you specify.

As mentioned, you can redirect input and output to come from or go to a file, but that is not the only way I/O can be used. You can also send the contents of a file to someone as an email. It is virtually limitless as to what you can do when learning how to manage I/O; the secret is in learning the commands and characters and mastering how they can be used.

You can also hook up programs into a pipeline through a pipe, in which the standard output STDOUT of one program feeds directly into the standard input STDIN of another. An example of this could be seen if you were to send your email output to a printer directly. Pipes will be covered in the last section of this lesson.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.203.137