[Top][All Lists]

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

Feature: disallow | >

From: Ed Avis
Subject: Feature: disallow | >
Date: Tue, 17 Mar 2015 16:40:35 +0000

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 when making pipelines you may mistakenly put an extra | at the last step 
before the output redirection.

Bash should forbid the odd syntax with | immediately followed by >.
If you have | it must be followed by a command.  Note that in most cases this 
is already required:

% | # syntax error
% whoami | # syntax error

Ed Avis <address@hidden>

This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com

reply via email to

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