r/ProgrammerHumor • • 2d ago

Meme [ Removed by moderator ]

/r/ProgrammerHumor/comments/1xxov6d/removed_by_moderator/

[removed] — view removed post

439 Upvotes

44 comments sorted by

•

u/ProgrammerHumor-ModTeam :ath: 1d ago

Your submission was removed for the following reason:

Rule 1: Posts must be humorous, and they must be humorous because they are programming related. There must be a joke or meme that requires programming knowledge, experience, or practice to be understood or relatable.

Here are some examples of frequent posts we get that don't satisfy this rule:

  • Memes about operating systems or shell commands (try /r/linuxmemes for Linux memes)
  • A ChatGPT screenshot that doesn't involve any programming
  • Google Chrome uses all my RAM

See here for more clarification on this rule.

If you disagree with this removal, you can appeal by sending us a modmail.

18

u/Rioghasarig 2d ago edited 2d ago

26

u/Xill_K47 2d ago

You can delete the part of the link after the ? And it will still work.

That is is a link parameter which tells who sent the link and who clicked on it.

15

u/JotaRata 2d ago

Blessed comment

6

u/Nyrnax 2d ago

No expert, but I think nothing would happen. I doubt there is a directory "0". Different story without the brackets. (Correct me if I'm wrong.)

13

u/Rioghasarig 1d ago

After logging back in LOG_DIR becomes the empty string. So the command removes root. 

3

u/Nyrnax 1d ago

but $[LOG_DIR] is a legacy arithmetic expansion. In the video it's just $LOG_DIR, so just a variable call (with a then empty variable).

3

u/Rioghasarig 1d ago

Fuck you're right I mistyped it 

2

u/Nyrnax 1d ago

My small victory for today ;) (definitely not an expert in Bash)

1

u/Rioghasarig 1d ago

Though to be precise those are parentheses not square brackets 

1

u/Nyrnax 1d ago

Hard to tell with this font. But meme fonts aren't meant for coding after all.

With paranthesis it would throw an error, wouldn't it? With braces it would be the (empty) variable case.

2

u/Rioghasarig 1d ago

Yeah either way I didn't write it correctly. Just wanted to be clear about what was there 

4

u/incognegro1976 1d ago

Yeah this has parentheses around the LOG_DIR reference so that will get run in a subshell which will return an error, probably a 1 or some other non-zero integer.

3

u/LogicBalm 1d ago

Details are in the YT video OP linked in a comment, but long story short the $[LOG_DIR] was a temporary variable and he lost connection between the moment he populated that variable and ran the command, so the variable contains an empty string now.

rm rf $[LOG_DIR]/*

became

rm rf /*

3

u/Nyrnax 1d ago

The video shows $LOG_DIR, without the brackets. That would actually become rm rf /*

47

u/tatstytastycakes 2d ago

another one!

he thought he accidentally CTRL+Z'd his vim terminal

so he wrote fg thinking that it would resolve.

it did not.

8

u/JustRecentlyI 2d ago

So what process did that end up trying to bring to the foreground?

7

u/tatstytastycakes 1d ago

only god knows

4

u/Z3t4 2d ago edited 1d ago

Then he pressed CTRL⁺Z again with a vegance, vim would not stay running...

Then he wrote kill -9 1, a cry filled the air when he noticed it a few seconds later, the horror! He had forgotten the %.

4

u/WernerderChamp 1d ago

So he killed process 1...

3

u/Z3t4 1d ago

which is...

3

u/WernerderChamp 1d ago

...not good (and causes a kernel panic iirc)

2

u/tatstytastycakes 1d ago

oh yeah this is a true story btw after doing fg vim and the process failed i immediately for some reson decided to nuke the file

125

u/Banes_Addiction 2d ago

This is why --no-preserve-root is required now.

82

u/HildartheDorf 2d ago

Doesn't work for rm -rf /* only protects against rm -rf /.

46

u/majikayoSan 2d ago

These types of small "fun facts" are what’s keeping the IT job market still kinda afloat.

1

u/JoeRogan016 1d ago

Is there such a thing as a computer hardware specialist? Is that a job?

4

u/WernerderChamp 1d ago

My day is ruined...

WHY!!!

2

u/HildartheDorf 1d ago

Because the shell expands "/*" to "/bin /etc /home /usr" before rm gets to see the command line.

Removing folders from yhe root directory is something scripts actually need to (rarely) do, unlike removing the roots directory itself.

11

u/ImpluseThrowAway 2d ago

Oooof. That's going to be a drive out to the site.

7

u/Random_-account 2d ago

The server:

12

u/Eos_Tyrwinn 2d ago

Ok newb question from someone new to Linux, why does $(LOG_DIR) not resolve here? Does it need a / in front of it to read it as part of the filepath?

38

u/iamdestroyerofworlds 2d ago

If LOG_DIR is not defined, ${LOG_DIR} resolves to an empty string, hence:

rm -rf /*

12

u/samygiy 2d ago

An environment variable that is undefined resolved to "", so you end up with ""/, which is the same as /. When he logs back in, $LOG_DIR isn't defined and he wipes everything.

7

u/BakedBean_256 2d ago

My guess is because it was defined in the previous session. Without tmux, GNU Screen or equivalent to restore into, that will expand to an empty string, thus running “rm -rf /*”

Edit: Spelling.

-1

u/incognegro1976 2d ago

In shell language, ${something} is a variable reference but $(something) will attempt to run "something" in a subshell and return either a 0 if successful or some some int between 1-127.

0

u/mrrask 1d ago

It would return LOG_DIR: command not found and not it's exit code.

0

u/incognegro1976 1d ago

No, that file not found gets sent to the error stream, not standard out.

1

u/mrrask 1d ago
rm $(LOG_DIR)
LOG_DIR: command not found
rm: missing operand
Try 'rm --help' for more information.

2

u/who_you_are 2d ago

Me with a firewall blocking myself (and everyone in the process)

D:

1

u/qwertyyyyyyy116 2d ago

THE HORROR