In bash, you can pipe the same output to two commands using {}, i.e. in the following:

cmd0 | { cmd1 ; cmd2 ;} | cmd3

cmd1 and cmd2 get the output of cmd0 in their stdin, and cmd3 gets the output of cmd2 appended to output of cmd2 in its stdin.

What's the name of this {} feature and is there an equivalent in fish?

  • What exactly does "fish" stand for? Could you please provide a link to make it unambiguous? Did you take into account wether and why you really need to script this in "fish"? – Nepumuk Feb 6 at 18:49
  • 2
    @Nepumuk did you check the tags? – Peeyush Kushwaha Feb 6 at 19:11

The feature is called command grouping.

In the fish shell, it appears to be provided by using begin and end in place of bash's { and } braces - a feature I only discovered from a bug report:

Note that regardless of shell, the first command that is able to do so will consume standard input ex.


$ echo foo | { sed 's/oo/aa/'; sed 's/oo/um/'; }


> echo foo | begin sed 's/oo/aa/'; sed 's/oo/um/'; end


> echo foo | begin echo cmd1 ; sed 's/oo/um/'; end
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.