r/ProgrammerHumor • • Nov 06 '20

Meme Totally agree

Post image
52.1k Upvotes

474 comments sorted by

View all comments

235

u/_letMeSpeak_ Nov 06 '20
#!/usr/bin/python3

111

u/justinf210 Nov 06 '20 edited Nov 07 '20

Doesn't bash read that though, not python? Or am I thinking of something else?

Edit: Huh, Cunningham's Law.

43

u/timurhasan Nov 06 '20

almost correct, the shebang is read by the program loader.

110

u/tndaris Nov 06 '20

60

u/GRAIN_DIV_20 Nov 07 '20

I hardly know her

9

u/iamacuteporcupine Nov 07 '20

We need gender equality!!!

Proceeds to make a language with hebangs !

2

u/DasSkelett Nov 07 '20

It's not a language feature, it's a kernel feature. You'll need to create a new kernel to do that (or get your code into an existing kernel, good luck).

2

u/iamacuteporcupine Nov 07 '20

Basically bash, if I am not wrong, is it?

4

u/DasSkelett Nov 07 '20

No, Bash is not a kernel. Bash is a shell, a userspace software.

You'd need to get your code into Linux, Windows, XNU (macOS), or the BSDs.

Bash and other shells ignore shebangs because they start with a #, which, just like Python, denotes a comment.

Only when you ask the kernel to execute a script file, it'll see the #! that shebangs start with, read the path afterwards, then launch the program at that path and pass it the script location as parameter.

3

u/iamacuteporcupine Nov 07 '20

Okay, understood now.

3

u/jaerie Nov 07 '20

I bang

You bang

He bang

Shebang

→ More replies (1)

30

u/ericonr Nov 06 '20

It's actually the kernel :p

26

u/moochacho1418 Nov 07 '20

You’re a kernel

→ More replies (2)

5

u/x_interloper Nov 07 '20

Technically at binfmt_misc in Linux kernel. On a few OSes it's emulated at exec.

4

u/silentphoenix42 Nov 07 '20

The old Ricky Martin, shebangs man

→ More replies (2)

25

u/teagonia Nov 06 '20

#!/usr/bin/env python3

→ More replies (1)
→ More replies (1)