home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

print

print [ output-expr [, ...]] [ dest-expr ]

Evaluate the output-expr and direct it to standard output, followed by the value of ORS . Each comma-separated output-expr is separated in the output by the value of OFS . With no output-expr , print $0 .

Output Redirections

dest-expr is an optional expression that directs the output to a file or pipe.

> file

Directs the output to a file, overwriting its previous contents.

>> file

Appends the output to a file, preserving its previous contents. In both cases, the file is created if it does not already exist.

| command

Directs the output as the input to a Unix command.

Be careful not to mix > and >> for the same file. Once a file has been opened with > , subsequent output statements continue to append to the file until it is closed.

Remember to call close() when you have finished with a file or pipe. If you don't, eventually you will hit the system limit on the number of simultaneously open files.


Previous: Reference: nextfile UNIX in a Nutshell: System V Edition Next: Reference: printf
Reference: nextfile Book Index Reference: printf

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru