help-bash
[Top][All Lists]
Advanced

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

Re: Use of |&


From: goncholden
Subject: Re: Use of |&
Date: Mon, 13 Feb 2023 15:45:19 +0000


------- Original Message -------
On Monday, February 13th, 2023 at 3:37 PM, Greg Wooledge <greg@wooledge.org> 
wrote:


> On Mon, Feb 13, 2023 at 03:22:01PM +0000, goncholden via wrote:
> 
> > Have seen the use of "|&" rather than the usual "|". What is the reason for 
> > using
> > 
> > "|&" exactly ?
> 
> 
> This is one of the easier things to find in the manual.
> 
> Pipelines
> A pipeline is a sequence of one or more commands separated by one of
> the control operators | or |&. The format for a pipeline is:
> 
> [time [-p]] [ ! ] command [ [|⎪|&] command2 ... ]
> 
> The standard output of command is connected via a pipe to the standard
> input of command2. This connection is performed before any redirec‐
> tions specified by the command (see REDIRECTION below). If |& is used,
> command's standard error, in addition to its standard output, is con‐
> nected to command2's standard input through the pipe; it is shorthand
> for 2>&1 |.
> 
> 
> I don't use it, nor do I recommend it. I'd prefer to stick with 2>&1 |
> 
> because that'll work everywhere, and won't confuse the reader (as much,
> one hopes).

Does it make sense to use 'cmd 2>&1 | getline var' when calling getline ?  Or 
doing 'cmd | getline var' is good enough ?




reply via email to

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