this post was submitted on 12 Mar 2025
723 points (98.4% liked)

Programmer Humor

22696 readers
1740 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

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Scoopta 115 points 1 month ago (1 children)

...this is so much more cursed than it needs to be. If you want to bash in C just system("echo hello world");

[–] [email protected] 58 points 1 month ago (2 children)

That wouldn't necessarily be bash though

[–] [email protected] 59 points 1 month ago (1 children)

Fine, system("bash -c 'echo hello world'"); then!

[–] [email protected] 10 points 1 month ago (3 children)

Now print "¯\_(ツ)_/¯" with the quotes

[–] [email protected] 17 points 1 month ago

I decided to throw my PC in the composter and become a gardener

[–] Beanie 4 points 1 month ago

my best guess: system("bash -c 'echo \\\"¯\\\\_(ツ)_/¯\\\"'");

which will get parsed as: bash -c 'echo \"¯\\_(ツ)_/¯\"'

which will run: echo "¯\_(ツ)_/¯"

and since echo just prints whatever was given to it, it'll print "¯\_(ツ)_/¯" with the quotes

[–] [email protected] 3 points 1 month ago

That was actually the first line of C I've ever written so there's no way I'm guessing the right number of escapes, but I guess I'd cheat by finding the value of each char and printing those one at a time.

[–] Scoopta 21 points 1 month ago

Fair, should've just said shell