add tag
PeterVandivier
As noted [here][1], `|&` is useful in `csh` (and other shells) for capturing both stdout and stderr you want to redirect. 

Today I noticed a typo in a running script. 

```csh
/bin/csh

psql -c 'select 1;' |& tee foo
psql -c 'select 2/0;' | & tee -a foo
psql -c 'select 3;' | & tee -a foo
```

To my surprise, this did not throw an error. 

```csh 
% cat foo
 ?column? 
----------
        1
(1 row)

ERROR:  division by zero
 ?column? 
----------
        3
(1 row)

% 
```

Or rather... it didn't throw the error I would expect running the same script in `bash` or `zsh` - where I expect...

> syntax error near unexpected token \`&'

...and for my batch to abort before my 3rd `psql` statement is executed & logged.

Why does `csh` accept `| &` as equivalent to `|&` and what are the general syntax rules that enforce this.

[1]: https://stackoverflow.com/a/32012193/4709762

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.