3 ms·
Not sure why this link and/or question is here, except to say LLMs like this incantation. It redirects STDERR (2) to where STDOUT is piped already (&1). Good f
by vessenes 8mo ago
Not sure why this link and/or question is here, except to say LLMs like this incantation.
It redirects STDERR (2) to where STDOUT is piped already (&1). Good for dealing with random CLI tools if you're not a human.
- ElijahLynn 8mo agoI found the explanation useful, about "why" it is that way. I didn't realize the & before the 1 means to tell it is the filedescriptor 1 and not a file named 1.
- weavie 8mo agoI get the ocassional file named `1` lying around.
- LtWorf 8mo agoIt's an operator called ">&", the 1 is the parameter.
- WJW 8mo agoWell sure, but surely this takes some inspiration from both `&` as the "address of" operator in C as well as the `>` operator which (apart from being the greater-than operator) very much implies "into" in many circumstances. So `>&1` is "into the file descriptor pointed to by 1", and at the time any reasonable programmer would have known that fd 1 == STDOUT.
- hrmtst93837 8mo ago[flagged]
- WhyNotHugo 8mo agoHumans used this combination extensively for decades too. I'm no aware of any other simple way to grep both stdout and stderr from a process. (grep, or save to file, or pipe in any other way).
- TacticalCoder 8mo ago"not humans" are using this extensively precisely because humans used this combination extensively for decades. It's muscle-memory for me. And so is it for LLMs.
- GetTheFacts 8mo ago>It's muscle-memory for me. And so is it for LLMs. LLMs have neither muscles nor memories. They're token combinators based on statistical correlation, no more, no less. That's not to say LLMs can't be useful when they string together tokens. Quite the contrary, in fact. But let's not pretend LLMs are something they're not.
- anitil 8mo agoI've also found llms seem to love it when calling out to tools, I suppose for them having stderr interspersed messaged in their input doesn't make much difference