[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: command line processing order
On 5 July 1994, Arnold Robbins wrote:
> This bit me the other day:
>
> ; ls
> a b c d
> ; cat * > foo
> cat: input foo is output
>
> The wildcard expansion is happening *after* the I/O redirection. The Bourne
> shell and Byron's rc both do the wildcard expansion first, and I think this
> is the right way to go.
This would be a hard thing to change. In raw es (try es -nx) the
command becomes
{%create 1 <={%one foo} {cat *}}
which pretty much determines the sequence. %create doesn't have the
option to glob the command, create the file, and then execute. (In
fact, it's not even as simple as that description implies.)
Interestingly enough, the Bourne shell really does seem to do the
operations in the order that you specify:
$ >foo cat *
Input/output files 'foo' identical
$
Neither es nor rc preserves this much faithfulness to the order of
coponents of a command line.