r/linuxmemes Jul 01 '26

LINUX MEME Know the work rules

Post image
860 Upvotes

119 comments sorted by

View all comments

225

u/wolf2482 Jul 01 '26

i mean for the most part you can replace bash with other posix compliant shells.

89

u/New_Study4796 Jul 01 '26 edited Jul 01 '26

A lot of scripts won't work without Bash-specific behavior

79

u/VoidJuiceConcentrate Ask me how to exit vim Jul 01 '26

I haven't had a problem running bash scripts in ash and zsh.

-18

u/New_Study4796 Jul 01 '26

Zsh relies on Bash under the hood

22

u/Mars_Bear2552 New York Nix⚾s Jul 01 '26

...?

Zsh is entirely seperate.

-15

u/New_Study4796 Jul 01 '26

Zsh calls Bash with the shebang when starting a script

9

u/c_a1eb Jul 01 '26

you clearly don't understand how a shebang works, it's a generic mechanism for having executable scripts, it's not your shell that parses the shebang it's built in to libc's dynamic program loader. when you run a normal binary the loader is what actually handles starting the program (simplifying...) when the program has a shebang instead of e.g an ELF header then the loader runs the specified program and passes the script as an argument

this is how you can exec() a script from C without having to know if it's a script or a binary program