3 ms·
Sometime all you need is to RTMF from the source instead of Nth hand information (N > 1) https://www.gnu.org/software/bash/manual/html_node/Redirections.html h
by ontouchstart 7mo ago
Sometime all you need is to RTMF from the source instead of Nth hand information (N > 1)
https://www.gnu.org/software/bash/manual/html_node/Redirections.html https://www.gnu.org/software/bash/manual/html_node/Redirecti...
- GuB-42 7mo agoGreat 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.
- layer8 7mo ago> 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.
- GuB-42 7mo agoWhat 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.
- shevy-java 7mo agoAnd how do you find that? Google search literally is useless for these days, for Average Joe.
- giglamesh 7mo agoDo these days include the nearly seventeen years ago when this question was posted? ;)
- ontouchstart 7mo agohttps://www.gnu.org https://www.gnu.org was there for decades, much older than SO and google. I know GNU -> Google -> SO -> LLM is a culture shift, this is how human attention goes. The search engine and LLM only capture the latest group attention and we have short memory. That is why reading is a critical skill for us as human beings, we can't afford to outsource that to machine. (Same with writing.)
- momentoftop 7mo agoTry "info bash" on your system. It's the same manual. In Emacs, when I hit C-h i I get a menu of all my info manuals and I first read the bash one there.
- ontouchstart 7mo agoThat is correct. And also simple `man bash`: REDIRECTION Before a command is executed, its input and output may be redirected using a special notation interpreted by the shell. Redirection may also be used to open and close files for the current shell execution environment. The following redirection operators may precede or appear anywhere within a simple command or may follow a command. Redirections are processed in the order they appear, from left to right. In the following descriptions, if the file descriptor number is omitted, and the first character of the redirection operator is <, the redirection refers to the standard input (file descriptor 0). If the first character of the redirection operator is >, the redirection refers to the standard output (file descriptor 1). The word following the redirection operator in the following descriptions, unless otherwise noted, is subjected to brace expansion, tilde expansion, parameter expansion, command substitution, arithmetic expansion, quote removal, pathname expansion, and word splitting. If it expands to more than one word, bash reports an error. Note that the order of redirections is significant. For example, the command ls > dirlist 2>&1 directs both standard output and standard error to the file dirlist, while the command ls 2>&1 > dirlist directs only the standard output to file dirlist, because the standard error was duplicated as standard output before the standard output was redirected to dirlist. ...