I use some AppleScript shebang file; I give them all the extension .sh regardless of the shebang-line.
So for example hello.sh:
#!/usr/bin/env osascript
get "Hello there"
Everytime I save this file, I get the error message:
File Extension Invalid
The filename extension ‘sh’ is not valid for this document type, which should be saved with a filename extension of ‘applescript’. Do you want to correct this discrepancy?
While this might be helpful in other situations, I think this warning should not be given when the first line of the file is a shebang.
Also: I’m curious how other people name their shebang scripts.
Where can I get info on using AS with shebang and other languages? This is the first AS-shebang I have heard of. Is there an Apple reference manual somewhere?
I suspect the only documentation is that in the release notes, from back in OS X 10.5:
AppleScript now allows # as a comment-to-end-of-line token, in addition to --. This means that you can make a plain text AppleScript script into a Unix executable by beginning it with the line #!/usr/bin/osascript and giving it execute permission. For details of osascript usage, including how to access command line arguments from the script, see the osascript(1) man page.
All of my AppleScripts are shebang scripts, but I do tend to use the .applescript extension. They all seem to run equally well from inside a shell (I use Bash and FiSh) or from within a script editor (I switch between Script Editor, Script Debugger, and Atom).