help-bash
[Top][All Lists]
Advanced

[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: Alex fxmbsw7 Ratchev
Subject: Re: What code make both `cat < /tmp/1.txt` and `< /tmp/1.txt cat` valid?
Date: Wed, 12 May 2021 13:25:37 +0200

there are different layers of affective command parts
> and < redirs are *coded* to be available everywhere nearly on the cmdline
so
.. ?

On Mon, May 10, 2021, 17:32 Peng Yu <pengyu.ut@gmail.com> wrote:

> I am trying to understand how bash is implemented
>
> $ seq 3 > /tmp/1.txt
> $ cat < /tmp/1.txt
> 1
> 2
> 3
> $ < /tmp/1.txt cat
> 1
> 2
> 3
>
> https://git.savannah.gnu.org/cgit/bash.git/tree/parse.y#n729
>
> I see `redirection_list` is just a list of redirection.
>
> redirection_list: redirection
>         |       redirection_list redirection
>
> But then it should be following `shell_command`. How come
> redirection_list can be anywhere in a command including the beginning?
>
> command:
> ...
>         |       shell_command redirection_list
>
> --
> Regards,
> Peng
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]