Content deleted Content added
Clean up duplicate template arguments using findargdups |
m →Redirecting standard input and standard output: <syntaxhighlight lang="console"> |
||
Line 11:
===Basic===
Typically, the [[syntax]] of these characters is as follows, using <code><</code> to redirect input, and <code>></code> to redirect output. <syntaxhighlight lang="bash" inline>
Using <syntaxhighlight lang="bash" inline>
<syntaxhighlight lang="bash" inline>
===Variants===
Line 21:
To read from a stream literal (an inline file, passed to the standard input), one can use a [[here document]], using the <code><<</code> operator:
<syntaxhighlight lang="
$ tr a-z A-Z << END_TEXT
> one two three
> uno dos tres
> END_TEXT
ONE TWO THREE
UNO DOS TRES
</syntaxhighlight>
To read from a string, one can use a [[here string]], using the <code><<<</code> operator: <syntaxhighlight lang="bash" inline>tr a-z A-Z <<< "one two three"</syntaxhighlight>, or:
<syntaxhighlight lang="
$ NUMBERS="one two three"
$ tr a-z A-Z <<< "$NUMBERS"
ONE TWO THREE
</syntaxhighlight>
|