Changes

Jump to: navigation, search

BASH Redirection

1,059 bytes added, 22:12, 15 September 2008
Redirecting Input
== Redirecting Input ==
[[BASH]] uses the <code><</code> and <code><<</code> symbols to redirect input.The <code><</code> symbol used after a command and arguments and is followed by the filename from which input will be taken. If the input file does not exist, an error message is displayed. For example:  mail -s "Suggestion" joe@example.com <draft3.txt This command will mail the contents of the file "draft3.txt" to joe@example.com with a subject line of "Suggestion". The <code><<</code> symbol is only used within scripts. It is placed after a command and arguments and is followed by a text label. The lines after the command up to (but not including) the line containing the text label are used as the stdin of the command. For example:  mail -s "Warning" joe@example.com <<EOF This is a warning that the disk space on your system has fallen below 1 GB. It is recommended that you delete some files to free up additional disk space. EOF This will use the three lines after the <code>mail</code> command and before the EOF line as the stdin to the <code>mail</code> command (i.e., the body of the e-mail message). == Cloning File Descriptors ==

Navigation menu