2 ms·
In the first case, you're actually executing two shells. (cmd 2>&1) runs in its own subshell, and copies stderr to stdout. >file is interpreted in t
by dredmorbius 14y ago
In the first case, you're actually executing two shells.
(cmd 2>&1)
runs in its own subshell, and copies stderr to stdout.
>file
is interpreted in the parent shell, and copies stdout to 'file'.
In the second instance, you run a single shell, first copying stdout to 'file', then copying stderr to the (redirected) stdout, that is, 'file'.