5 ms·
Just like .com didn’t cause confusion with DOS and Windows .com executables.
by sinatra 8y ago
Just like .com didn’t cause confusion with DOS and Windows .com executables.
- raimue 8y agoJust like .sh didn't cause confusion with the .sh extension for shell scripts.
- adtac 8y agoExcept, .sh means nothing in particular in Linux. It just so happens people use .sh for shell scripts.
- cat199 8y agoIt just so happens people unnecessarily use .sh for shell scripts.
- sbarre 8y agoI think it's used for UX reasons actually.. "Oh, I see this is a shell script" when listing a directory..
- hk__2 8y agoWhy would that be unnecessary? Are we supposed to use extension-less filenames and then guess their type every time by looking at their content?
- carapace 8y agoShould URLs end in .html?
- hk__2 8y agoWeb servers respond to your requests stating what type of content they’re sending you. There’s no such thing for files on disk.
- carapace 8y agofile? https://linux.die.net/man/1/file https://linux.die.net/man/1/file
- rtkwe 8y agoFile is still only a best guess at content and relies on the format being known and having some identifying features.
- carapace 8y agoIt works with shell scripts. Having a name ending in '.sh' is less reliable than the output of file for identifying shell scripts, since any file can be named with that ending. cat199 said '.sh' is unnecessary and that is correct. I am surprised that this is controversial. (except wait, no, this is the internet... I'm not surprised. ;-)
- hk__2 8y ago> It works with shell scripts. No. It works with some of them, because, as the parent wrote, it’s just the automated equivalent of "let’s look at content of the file and guess what it is". It’s not perfect, and so doesn’t always work. If you write "echo 42" in a file, `file` will only tell you it’s "ASCII text". We humans are used to identify things with their name. `.sh` is not necessary to execute a shell script; but it’s so convenient you must have a good reason not to use it.
- carapace 8y agoThere are over a hundred shell scripts in my /usr/bin/ dir that don't end in '.sh'. There are even Python scripts in there that don't end in '.py'. The world hasn't gone mad? Ending the filename of a shell script in '.sh', while a useful and common convention, is unnecessary (I appreciate you that you acknowledge that) so using that to identify shell scripts is a heuristic, just like what file does. Look, I don't want to argue about this. cat199 was catching downvotes for pointing out, quite correctly, that the '.sh' extension was just a convention, and, well... https://www.xkcd.com/386/ https://www.xkcd.com/386/ Filename extensions have always been a crappy hack to get around the omission of useful metadata associated with a file on some early filesystems. Gnome file viewer thing doesn't even sort by them!
- gsich 8y agoIt's not. It helps you find stuff.
- makomk 8y agoIt helped a little that .com executables were pretty much obsolete by the time the web became common, but that was still a pretty nice gift to early malware authors.
- bdcravens 8y agoI remember when I first started hearing about the web (around circa 95) and I was playing alot with DOS thinking that the two were connected.