Shell Scripting Style

Colin Watson cjwatson at ubuntu.com
Tue Jul 12 19:17:02 UTC 2005


On Tue, Jul 12, 2005 at 02:56:22PM -0400, Sean Sieger wrote:
> I have noticed both the absense /and/ the presense of white space
> adjacent to a pipe.
> 
> What is the logic of style when using pipes?

As usual, there is often little logic to style. :-)

Whitespace is used for clarity and visual separation; it's up to you.
Personally I note that whitespace (or some other word separator, but
usually whitespace) is required between arguments, and that the space
between commands ought to be at least as great as the space between
arguments, so I put whitespace around pipes.

> Do all pipes work with and without white space?

Yes; | is a word separator as well as performing its control function.

Cheers,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list