0

What is the meaning of ">&file" in Bash? How does it differ from ">file"?

echo abc >&file
Yuki Ito
  • 403
  • 4
  • 11
  • Here's a relevant answer (https://stackoverflow.com/questions/6674327/redirect-all-output-to-file-in-bash). In this specific case no difference (because echo doesn't use stderr - except in this case where abc ends up in stderr `echo abc 1>&2` – Mr R Mar 10 '21 at 13:07
  • https://stackoverflow.com/questions/876239/how-to-redirect-and-append-both-stdout-and-stderr-to-a-file-with-bash/876242#876242 – William Pursell Mar 10 '21 at 13:09
  • https://stackoverflow.com/a/637839/140750 – William Pursell Mar 10 '21 at 13:10

1 Answers1

1

It's a bash shortcut for > file 2>&1 So fds 1 and 2 are both redirected to the file.

William Pursell
  • 204,365
  • 48
  • 270
  • 300