From Linux Shell Scripting Tutorial - A Beginner's handbook
Revision as of 04:57, 22 September 2009 by Admin
- Standard output is used by a command to writes (display) its output.
- The default is the screen.
- It is denoted by one number (1).
- Also known as stdout.
- The default standard output is the screen.
- > is output redirection symbol and syntax is:
command > output.file.name
For example, ls command by default writes its output to the screen:
But, you can save the output to a file called output.txt, enter:
ls > /tmp/output.txt
To view file, enter:
- Please note that /tmp/output.txt file is created if it doesn't exist. And if file /tmp/output.txt file is overwritten if it exits.
- You can also save your script output to the file:
./your.script.name.sh > myoutput cat myoutput