Thanks Ralph and Patrick.

> it [ |& ]  is shorthand for 2>&1 ...bash also adds ‘&>foo’ meaning ‘>foo
2>&1’.  Likewise ‘&>>’.

Well we live and learn. I'm going to add this to my catalogue of scenarios
where I have developed a muscle-memory for doing things an 'old' way, and
then a new and usually better better way has come along while I wasn't
looking.

Saying 'do_something_interesting 2>&1 > something_interesting.log' or
'do_something 2>&1 | grep -i whoopsie' have been in my mental toolbox so
long I can find them in the dark. So I never thought of looking for newer
shinier versions.

I must find my way back to Bournemouth sometime for one of the monthly
meetups.

best regards,
웃
Victor Churchill,
Netley Abbey, Southampton
07970 844083


On Fri, 5 Jul 2019 at 12:55, Ralph Corderoy <ra...@inputplus.co.uk> wrote:

> Hi Victor,
>
> Hope life's treating you well since you moved ‘abroad’.
>
> Patrick wrote:
> > > > (yada yada) |& curl -sSF 'f:1=<-' ix.io
> > >
> > > I was puzzled to see the '&' in your command above.
>
> Patrick's answered that ‘|&’ is a bash shorthand for ‘2>&1 |’.
>
> > > I'd have thought that saying
> > >     (yada yada) | curl -sSF 'f:1=<-' ix.io
> > > would do the trick
>
> If the sub-shell in parenthesis produced any stderr for Clive, which
> would probably be interesting to us, then it would appear on his TTY and
> not be piped to curl so we see it.  Redirecting stderr to the same place
> as stdout, the pipe, avoids this.
>
> > In bash(1), |& is one operator, not two.
>
> bash also adds ‘&>foo’ meaning ‘>foo 2>&1’.  Likewise ‘&>>’.
>
> --
> Cheers, Ralph.
>
> --
>   Next meeting: BEC, Bournemouth, Tuesday, 2019-08-06 20:00
>   Check to whom you are replying
>   Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk/
>   New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk
>
-- 
  Next meeting: BEC, Bournemouth, Tuesday, 2019-08-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk/
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to