7

Why does

exec >somefile

return immediately, while

exec 2>somefile

doesn't and hang on indefinitely? Thanks.

Tim
  • 101,790
  • ... but fails to ask, let alone answer, why keyboard input appears to stop working, and thus the "hang". – JdeBP Jun 01 '18 at 14:30

1 Answers1

18

It doesn't hang. If you're running interactively, and you look inside somefile, you'll see your prompt. STDERR is where bash writes the prompt to.

phemmer
  • 71,831