How to hide multiple command output in fish shell?

Viewed 548

Let's say there is a set of commands as follows:

#!/usr/bin/env fish

command1
command2
command3

Each command prints its own output, which I want to hide. In bash it's rather simple:

#!/usr/bin/env bash
{
command1
command2
command3
} &> /dev/null

But it does not work in fish. Is there any solution other than sending each and every command to /dev/null? Can somebody help me with that?

2 Answers

Fish's equivalent to {} command grouping is begin and end, so

begin
    command1
    command2
    command3
end &> /dev/null

Here is rather crude workaround:

#!/usr/bin/env fish

function CommandList
    command1
    command2
    command3
end

CommandList &> /dev/null

Hopefully somebody will have a real solution to this problem...

Related