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

Great if you know where to look, but most people who ask themselves the question don't know they have to look up the bash manual in the "redirection" section.

The usual thing (before LLMs) is to Google the question, but for the question to appear in Google, someone has to ask it first, and here we are.

Also the Stackoverflow answers give different perspectives, context, etc... rather than just telling you what it does, which is useful to someone unfamiliar with how redirections work. As I said, someone who doesn't know about "2>&1" is unlikely to be an expert given how common the pattern is, so a little hand holding doesn't hurt.

 help



> Great if you know where to look, but most people who ask themselves the question don't know they have to look up the bash manual in the "redirection" section.

Where else would you look but in the manual of your shell? And you don’t have to know in which section to look, you can just search for “2>&1” in the bash man page.


What is a command and what is shell syntax is not always obvious, especially to a beginner, which I assume most people asking this question are.

Take the command "ls -l ~/.. ; fg" for instance. What is interpreted by the shell and what are commands? If you have some experience in bash, you probably know, and therefore you know which part to look in which man page, but you probably also know "2>&1".

Spoiler: "-l" is part of the command, so look in the "ls" manpage. "~", is expanded by the shell, ";" is shell syntax and "fg" is a builtin, all three are in the "bash" manpage. ".." is part of the filesystem.




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

Search: