Ascript naming convention what are the names that we should use when you create a script first.
First of all I will tell you that every time you need to create scripts in your Linux environment always
create a directory.
Call it scripts or my scripts or if it's a project based scripts type like HTP directory or payroll
directory where you're going to create your scripts directory structure is very important so you don't
you don't create scripts all over the place.
So follow the standard create creature directory which ever folder just you pick that you want to create
your directory in.
That is fine then script name the script name should identify the function.
If you are going to get into a job or if your job functionality is airballs around creating a lot of
scripts doing a lot of automation then it's best that you name it that matches its purpose.
If you want to if your script is going to check the date check today's date and June you are naming
it x y z.
Then again a few months from the day you create you're going to forget what X Y Z is for.
So it's good that you name the date or something.
My date script or something like that and the script should end with a shell.
So if you are using bash cell then I would say write the name of the the name of the script followed
by dot B A S H.
Now this rule this rule should only be used which I usually follow this rule when I am creating multiple
shell scripts meaning if you are creating shellscript in Korn shell see Shell Perl or bash then you
need to have the extension at the end which is dot sh.
Korn shell.
So these are the few the three basic standards that you should have.
Let me log into my Linux machine and I will show you exactly what I wanted to cover here.
So if you go into your Linux machine and you log into your home directory let's say my home directory
is slash homes lash ups all in my home directory.
Notice I have a directory called scripts.
So this is what I mean.
So every time you create a script you need to create a directory first.
So this way you go into your script directory.
So this way you you don't have to scroll through and find out where your scripts are.
So in my home directory you'll see I have a very few files and directories it's very easy for me to
find out because it's a test environment.
But maybe you're working in an environment as you create thousands of directories.
So that's why it's important you create a directory called scripts.
Once you create this group directory then you could just go in and you'll see it right here in my home
directory.
I have a script called X Y Z script.
Now as I mentioned X Y Z descript it's not really a good name.
You cannot tell what exactly it does.
So if I run the script you'll see it actually spits out Hello world on the screen so that's exactly
what it does.
If I wanted to associated that script with a name then I should do is X Y Z script more Whitmore's the
command to change a name of a file.
I'm sure you know that and I will say hello world or w o complete name.
That's fine and we'll run that command and you'll see.
Now my script name has changed to Hello World.
Now if I am using multiple shells then I should label it as move.
Hello World dot.
Sorry.
Hello World dot B.
This way if I'm creating multiple scripts in Korn shell or C shell then I would know that this script
was created in bash.
So this is basically a very quick lesson.
Oh I do remember that this is the standard that you follow.
Also if you are doing that type of work in your environment and you decided to leave your job and move
on to another career and the person who is going to come and replace you that person I'm telling you
is going to be so happy.
Or even your manager is going to be so happy that you are so organized that all this crap that you created
while you stayed with the company are all organized and where to find them.