I was wondering if there is a convention for file type extensions for shell scripts you want to source instead of run. For example:
If I want to run this script in a subshell.
./script.sh
If I want to remember to run this script from the current shell.
. script.source
Is there a convention (like POSIX for example) for a filetype in the second example? Something like .source
or .sourceme
?
Update
This question does not ask about any opinion. I clearly stated that I would like to know if there is a standardized file extension for this kind of scripts. This question is even less opinion-based than this well received question on a similar issue (Use .sh or .bash extension for bash scripts?).
#!/bin/sh
or similar should have no extension, because the user should not need to care about what language the underlying script was written in.$PATH
, you come to use all the time , so its like,ps
,ls
,curl
and all the other commands, then you start to build shell completion functions around it, I find its ok to drop the extension. But yes, when you are sourcing a shell script, that are not executable by themselves, I would notchmod +x
them, and I would name themscript.sh
. also I often assign an extension purely because if I don't I won't get syntax highlighting on my editor.