I have some functional scripts and I want to copy to /usr/bin
I want to use them as normal terminal commands. Is it a good practice to use them with the .sh
extension or can I save them without extension?
I have some functional scripts and I want to copy to /usr/bin
I want to use them as normal terminal commands. Is it a good practice to use them with the .sh
extension or can I save them without extension?
No, it is not a good practice, you should keep your scripts without extension. Note, that scripts being part of packages doesn't have a .sh extension, i.e. update-grub, not update-grub.sh. If you are still not convinced, then be advised, that Google Shell Style Guide says:
Executables should have no extension (strongly preferred) or a .sh extension. Libraries must have a .sh extension and should not be executable.
PS You don't have to put your script into /bin
. You can create directory ~/bin
and put your script there. Directory ~/bin
is included in $PATH
by default, so scripts put there can be run as any other shell command.