friendica.eskimo.com

Stop Pretending "/bin/sh" Is A Real Shell #shorts​

https://www.youtube.com/watch?v=xQ4KJF-6Agc
Nanook friendica
It's the original shell but these days usually a symlink to bash or dash.
Kenneth Gardner ( pub) friendica (via ActivityPub)
This video is hilarious, from the dumb style to the deliberately bad misinformation.
rob mastodon (AP)
I'm pretty sure it's a mistake to symlink /bin/sh to a non-POSIX compliment shell.
Nanook friendica
@rob @Derek Taylor 🐧 Both dash and bash adjust their behaviors when called as /bin/sh.
rob mastodon (AP)
My understanding is that only commands that are POSIX-compliant will work when either of those shells are called with /bin/sh.
Zeth mastodon (AP)
Huh, and here I thought that /bin/sh WAS an actual POSIX-compliant shell...but if it's just a symlink to whatever the hell you have for shell then what exactly is the point of all that nonsense?
Nanook friendica
@Zeth @Derek Taylor 🐧 No but for systems with bash or dash it is, other shells like csh and tcsh can not pretend to be /bin/sh.
Zeth mastodon (AP)
not to mention the fact that POSIX standard is lowest common denominator across multiple systems, which seems to me like fundamentally flawed design - because rather than improving on the shortcomings, you instead limit the potential of more advanced implementations...
Zeth mastodon (AP)
perhaps I'm not seeing the full picture though.
Nanook friendica
@Zeth @Derek Taylor 🐧 No, you can write shell scripts #!/bin/bash to take full advantage of bash, or #!/bin/tcsh to use terrible cshell, or #!/bin/perl to use perl, etc.
dalz mastodon (AP)
/bin/sh is a *real* shell with a *real* specification and multiple, compatibile *real* implementations. You should always try to write POSIX compliant scripts if you don't have good reasons to do otherwise. Also, how could /bin/sh be the user's default shell? You can have multiple users with different login shells on your system, you know?
Nanook friendica
@dalz @Derek Taylor 🐧 Yes but the #!/bin/sh tells the operating system to use /bin/sh to execute that code REGARDLESS of what the users login shell is.
dalz mastodon (AP)
which is exactly what you want, since the user's shell could be bash, zsh, fish, ksh, oil, emacs, /usr/bin/nologin or anything else!
safi :verified: mastodon (AP)
he is obviously trolling.. lol
1

This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.