help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Why `<` has to be after `while`?


From: Eric Blake
Subject: Re: [Help-bash] Why `<` has to be after `while`?
Date: Mon, 12 Feb 2018 08:41:38 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 02/11/2018 01:43 PM, Peng Yu wrote:
Hi,

The following example shows that `<` has to be after `while`. But
there is no such restriction of a regulate command. Is it really
necessary to have this restriction for `while`?

Yes, this matches the grammar as originally implemented by the first 'sh' more than 40 years ago, and standardized by POSIX. Shell keywords (like 'while') are parsed differently than regular commands, and part of that difference is that redirection operators can't precede a keyword.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

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