Do wild scripts do what scripts are very similar to for loops strip scripts though do wild script or
Stakman continue.
Lee executes a block of segments while a particular condition is true are met.
For example if you are running a script and you created a loop it will run until a certain variable
is met.
For example if you have if you wanted to run the script until August 2015 to 2 p.m. Then you will define
that in do was script and a lot of times the scripts are the demons the process that never dies.
Keep running and running and running.
They always have do wild scripts because they are running continuously until a certain condition is
met.
So for example run a script until 2 p.m..
As soon as the 14:00 hits you are done.
Exit while condition.
Do come and one command to command three and once all these commands are done and the condition is done
then you are done.
You are done with your script so let's look at our Linux machine and let's try out a do was script.
That's because you of your screen where you are we are in my script directory which is this direction
we wanted to be in and this time we are going to create in this news clip and we were going to call
it script do well again.
It's just the name I'm picking you can pick anything you want.
Hit enter.
You are in vi mode.
You hit insert and you start typing was the first thing you type to type hash.
Bang bin bash which defines your shell environment.
And if you wanted to put a comma you could say this script is created by Imraan so on
2018 yeah that's fine.
And if you want to put a description of the script you could do that.
Let's get into the script.
I have already written a script and I'm just going to go in and copy it.
There are two scripts in my hand out.
I'm going to take the second one.
I want you to do the first one yourself.
Copy yet.
And I'm going to paste it real quick.
That see what the script does.
The script is doing of course the first one is defining the show which we already have some.
We're going to take it out by hitting d d.
And then it's telling us that the count is zero.
The number is 10.
While the count is less than 10 do echo number of seconds left to stop this process and the process
is the variable which is dollar one
and Echo is just empty space empty line.
Sleep sleep is a command that will wait for the number of seconds that is defined after the sleep command.
Then it has a few number of expressions.
These are the expressions you could get it anywhere online.
I have that expression for a while that I tried out many times in my work in wireman it works perfectly
and if you don't use it in your work environment you are more than welcome to do so the next one is
the echo and then echo dollar 1 process is stopped and echo again.
It is telling it that it's giving an empty line.
Let's run the script and see what it does.
And executable permissions
is just 10 seconds left to stop this process.
Nine eight seven six five four three two one and done.
Process is stopped.
You see that.
So these do what scripts are created for a certain value or a certain time to be met and once that variable
is met it will start the process and exit out of it.
I want you to create a new script in your environment and this is the script.
Again this is also in the handouts.
You could copy and paste this script.
Create a new script and run it.
You could also be my guest to go online and just type do was.
Examples.
There are tons and tons of new world scripts that you could try and get get a little exposure to do
what scripts.
I'm sure by the time you will run at least 5 or 6 scripts you know exactly what this statement do.