6

Why does

exec >somefile

return immediately, while

exec 2>somefile

doesn't and hang on indefinitely? Thanks.

marked as duplicate by JdeBP, Patrick, Jeff Schaller, Toby Speight, roaima Jun 1 '18 at 17:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.