Feature: disallow | >

2015-03-18 Thread Ed Avis
In bash, the empty command can be redirected to a file: % >out It will create or overwrite 'out' as the empty file. That may be useful. But somehow you can also say % whoami | >out This again writes empty content. I suggest this odd feature is not useful and indeed gets in the way, since whe

Re: Feature: disallow | >

2015-03-18 Thread Dan Douglas
On Tue, Mar 17, 2015 at 11:40 AM, Ed Avis wrote: > In bash, the empty command can be redirected to a file: > > % >out > > It will create or overwrite 'out' as the empty file. That may be useful. > But somehow you can also say > > % whoami | >out This isn't surprising or deserving of a special ca

RE: Feature: disallow | >

2015-03-18 Thread Ed Avis
The reason I found 'whoami | >out' to be surprising is that none of the following work: % | >out % (whoami |) % whoami | | cat If | > is a valid construct, what are its semantics? -- Ed Avis __ This email has been scanned by

Re: Feature: disallow | >

2015-03-18 Thread Andreas Schwab
Ed Avis writes: > If | > is a valid construct, what are its semantics? $ whoami | >out tr 'a 'b' Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

RE: Feature: disallow | >

2015-03-18 Thread Ed Avis
Thanks. So 'whoami | >out' working is a natural consequence of the fact that '>out' is a command by itself. IMHO it would have been better for the Unix shell to forbid that, and require ': >out' if you really do want to run the null command and redirect its output, but it's too late now. -- E

Re: Feature: disallow | >

2015-03-18 Thread Bob Proulx
Ed Avis wrote: > Thanks. So 'whoami | >out' working is a natural consequence of the > fact that '>out' is a command by itself. It is a natural consequence of parsing redirections before parsing commands. The redirection happens before the command execution and an empty command is valid. That re