Reputation: 11
Why does entering:
date >> log >> file
into BASH only append the date to file and doesn't affect log?
Upvotes: 1
Views: 39
Reputation: 924
To add on to Rici's answer, you can append to both files using tee
:
date | tee -a log file
Upvotes: 1
Reputation: 241761
Because there is only one stdout
. Bash allows you to redirect stdout
as many times as you like, but each redirect overrides the previous one, and all redirects are configured before the utility is executed.
This is also true of redirecting stdin
. cat < a < b
will only print the contents of b
, for precisely the same reason.
Upvotes: 4