this post was submitted on 17 Jan 2025
751 points (99.0% liked)
Programmer Humor
20155 readers
1845 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yes, but
2>&1 > /dev/null
is the real hero.No,
> /dev/null 2>&1
is. If try your example but with file instead null, stderr content not in file.Because x>y not redirect x to y, but duplicate y and set x to y-duplicate. See bash manpage REDIRECTION (your example in that section for what not work).
As i understand, your example set 2 to what 1 is, then set 1 to null. Now 2 not null, but what 1 before.
So, the joke is that it should hide all output.
Yes it do, your example do too. But if test thing and replace null with file, suddenly stderr missing. Happen to me, 5h debug session. Hope to help prevent that for other people.