20 ms·
> .bash is ugly "Ugly" is subjective. If I encountered a file with that extension, I'd assume it uses Bash-specific features and that I shouldn't run this scr
by hdjjhhvvhga 4y ago
> .bash is ugly
"Ugly" is subjective. If I encountered a file with that extension, I'd assume it uses Bash-specific features and that I shouldn't run this script with another shell.
- Octabrain 4y agoSubjetive, indeed. But unless I am missing something, the interpreter to be used should be determined by the shebang within the script though?
- selectnull 4y agoExtension or not, .sh or .bash: definitely subjective. That was the intention of my comment. Because the rest of the post (or most of it for sure) is not subjective.
- erlkonig 4y agoIt's the effect of the extension on USER behavior that's the problem, the OS doesn't care.
- Octabrain 4y agoYes, I get it. But in my case I simply give u+x permissions to the script and then run "./script.sh" and then the script will be executed with the interpreter defined in the shebang.
- ndsipa_pomu 4y agoThe hashbang already specifies the shell, so also having it in the extension seems unnecessary. I don't like using '.sh' as an extension as it differs from other OS commands and I can't think where it's actually helpful.
- Beltalowda 4y agoIf you download a script then running "sh script.sh" is a lot quicker and easier than a chmod followed by ./script.sh. You can of course also type "bash script.sh", but I don't always have it installed on every system, and the .bash extension just clarifies it. For things in my PATH I drop any suffixes like that.
- ndsipa_pomu 4y agoI see your point, but you can just as easily run "sh script" although that does imply that you already know that it's a shell script (obviously you wouldn't just run something from the internet without checking it first).
- jraph 4y ago> obviously you wouldn't just run something from the internet without checking it first This died a long time ago with the pervasive use of NPM and PIP and the likes. Most developers probably run a lot of random unchecked shit all the time with local user privileges today without a blink. Somehow people are ready for all this, but are still afraid to run a random shell script from the internet. I guess this fear is one of our chances to explain how NPM and PIP can be dangerous.
- ndsipa_pomu 4y agoIt's also fairly common to use a docker container that someone else built without having a look at it
- hdjjhhvvhga 4y agoI don't know. I do that a lot on test servers when tinkering with new stuff but at work I'm very careful what I insert into my employer's infrastructure. If someone breaks in using a hole I should have taken care of, that's already bad. But if invite bad guys by installing a C&C for them, that's superbad.
- krageon 4y ago