Hacker News new | ask | show | jobs
by justusthane 14 days ago
This is a minor nit, but why is OP's script a Python script with a .sh extension? I know the extension doesn't "matter", but if I see a .sh extension I'm expecting a Bash script.
2 comments

Cause it was written by AI?
If anything it proves the opposite imo.
Shebang! Notice the first line of the script: #!/usr/bin/env python3 marks the file to be executed by python. I think it's like a shell? linux? thing so that tooling can just execute the file without having to find the python interpreter (ie: _execute_ the file vs running python against the file).

Dont quote me on the specifics though, and honestly why it can't _just_ be a python file I couldn't tell you, claude code can very much run a python <filename> but maybe thats what the author tried to avoid (or the llm).

It’s a POSIX thing, and it has nothing to do with the file extension. The OP is right: file extensions are optional (and, as shown here, often actively misleading), but if they’re present they should match the actual file type. Which, in this case, is Python code , not a shell script.