[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What code make both `cat < /tmp/1.txt` and `< /tmp/1.txt cat` valid?
From: |
Greg Wooledge |
Subject: |
Re: What code make both `cat < /tmp/1.txt` and `< /tmp/1.txt cat` valid? |
Date: |
Wed, 12 May 2021 07:46:42 -0400 |
On Wed, May 12, 2021 at 01:25:37PM +0200, Alex fxmbsw7 Ratchev wrote:
> there are different layers of affective command parts
> > and < redirs are *coded* to be available everywhere nearly on the cmdline
> so
> .. ?
Redirections (of any kind) may appear anywhere in a simple command.
Redirections (of any kind) may only appear at the END of a compound command.
Simple command examples:
printf '%s\n' "$message" >&2
printf >&2 '%s\n' "$message"
> biglogfile
Compound command example:
while read -r line; do
process "$line"
done < <(grep foo "$logfile")