Redirect output in bash

From UVOO Tech Wiki
Revision as of 11:40, 27 March 2023 by Busk (talk | contribs) (Created page with "https://stackoverflow.com/questions/876239/how-to-redirect-and-append-both-standard-output-and-standard-error-to-a-file-wit ``` There are two ways to do this, depending on yo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

https://stackoverflow.com/questions/876239/how-to-redirect-and-append-both-standard-output-and-standard-error-to-a-file-wit

There are two ways to do this, depending on your Bash version.

The classic and portable (Bash pre-4) way is:

cmd >> outfile 2>&1
A nonportable way, starting with Bash 4 is

cmd &>> outfile
(analog to &> outfile)