top | item 47172933

(no title)

vessenes | 3 days 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.

discuss

order

WhyNotHugo|3 days ago

Humans 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|3 days 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.

ElijahLynn|3 days ago

I 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|3 days ago

I get the ocassional file named `1` lying around.

hrmtst93837|2 days ago

The distinction between file descriptors and regular files trips up many people at first. Recognizing that `&` signifies a file descriptor clears up the confusion about the syntax.

LtWorf|3 days ago

It's an operator called ">&", the 1 is the parameter.

anitil|3 days ago

I'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