Björn Tantau@swg-empire.de to Programmer Humor@programming.dev · 14 days agoPretty straight forwardswg-empire.deimagemessage-square47fedilinkarrow-up1723arrow-down111file-text
arrow-up1712arrow-down1imagePretty straight forwardswg-empire.deBjörn Tantau@swg-empire.de to Programmer Humor@programming.dev · 14 days agomessage-square47fedilinkfile-text
minus-squareScoopta@programming.devlinkfedilinkarrow-up113arrow-down1·14 days ago…this is so much more cursed than it needs to be. If you want to bash in C just system("echo hello world");
minus-squaresmeg@feddit.uklinkfedilinkEnglisharrow-up59arrow-down1·14 days agoFine, system("bash -c 'echo hello world'"); then!
minus-squarexthexder@l.sw0.comlinkfedilinkarrow-up10·13 days agoNow print “¯\_(ツ)_/¯” with the quotes
minus-squareultrafastsloth@lemmy.worldlinkfedilinkarrow-up15·13 days agoI decided to throw my PC in the composter and become a gardener
minus-squaresmeg@feddit.uklinkfedilinkEnglisharrow-up3·13 days agoThat 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.
minus-squareBeanie@programming.devlinkfedilinkarrow-up3·10 days agomy 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
…this is so much more cursed than it needs to be. If you want to bash in C just
system("echo hello world");
That wouldn’t necessarily be bash though
Fine,
system("bash -c 'echo hello world'");
then!Now print “¯\_(ツ)_/¯” with the quotes
I decided to throw my PC in the composter and become a gardener
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.
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 quotesFair, should’ve just said shell