Last week, I wrote a basic intro on bash shell scripting in this guide, we would take a look at how to name a script properly.
Let's get this straight, we mostly do name things abruptly in the real world, but you might want to be careful in a shell world as things aren't that black and white. When naming a script, you should not only give your script a sensible name, but you must also make sure it does not conflict with existing commands.
To give this a quick spin, try entering the following at the command prompt:
You'll receive the following output:
devsrealm@server:~/bin$ type test
test is a shell builtin
The type command tells you what the shell will execute (and where it can be found if it is an external file) for any given command.
As you can see, a command called test already exists, so if you call your script test, it will not run at the shell prompt, as there is an existing one. However, script names often end in .sh; even so, there might be other scripts on your system with the same name as the one you chose.
You can also use which or whereis command to locate where the command is located, so, if I do which
So, make sure you do proper checking before naming a script.