Para o bash
ip r add default via 192.168.1.254 &> outfile.txt
ou o formulário padrão para outras camadas:
ip r add default via 192.168.1.254 >outfile.txt 2>&1
de man bash
:
Redirecting Standard Output and Standard Error
This construct allows both the standard output (file descriptor 1) and
the standard error output (file descriptor 2) to be redirected to the
file whose name is the expansion of word.
There are two formats for redirecting standard output and standard er‐
ror:
&>word
and
>&word
Of the two forms, the first is preferred. This is semantically equiva‐
lent to
>word 2>&1