3

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?

Zoltar
  • 43
  • 6

2 Answers2

8

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

begin
    command1
    command2
    command3
end &> /dev/null
faho
  • 14,470
  • 2
  • 37
  • 47
1

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...

Zoltar
  • 43
  • 6