Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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'.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: