OK, so now that we, you know, got past some of the basic command stuff, let's talk about scripting
basics.
So actually, actually the language that used to navigate Nesquik commands in Linux.
So all of the demands that, you know, we've learned so far actually use the scripting with no modifications
in them whatsoever.
So congrats, because, you know, better scripting now.
So all you need to do is use those commands as a basic knowledge of Basche syntax.
And we're going to have the automating processes in no time like anything that we did.
Now, you can literally do that with a through so you can open up your preferred editing application
and, you know, get to work on some of the stuff that I'm about to show you right now.
So here's the basics.
So all backslaps typically start with this Paon in an exclamation point, slash slash bash, and that's
at the top of the file.
You're going to create an actual best script as a file.
So you're going to want to make sure that this is at the top every time that you make a battlegroup.
Dispersion tells the system what it's going to run this file with.
But this could be slash being slash python or something.
It was Python.
But right now, who needs Basche?
So that's what it's going to interpret all the following lines of code are as.
And just remember that the fans are going to execute in the order that you put them in.
If you want to declare it variable, you do the variable name equals and then your value.
If you want to access it, you would just write a dollar sign followed by the variable name.
If you want to print something out, you know, on the screen, you would just write Echo and then the
parentheses and put your text in there or you echo and the new variable name.
So let's go try some really great Lizzio, but a new file and V Basche practice.
OK, so we're going to go on to answer mode.
Remember we start close to the Palestine exclamation point, slash bean slash fast and now he knows
to interpret this as a bad script.
So we make a variable called this class and then we're going to be equals and we can do single quotes
right here or double quotes.
I want to say this class is super fun.
And I'm going to tell my friends about it.
There you go to make sure you do that.
So now let's go down and let's actually access this variables.
So echo dollar sign and then the variable names of this class.
So now hit escape right quick.
Bam, Alice.
Now, what are you going to see?
Is that the best practice?
I actually does not have execution.
Right.
So what we can do is a mild shortcut, which would be Siegmund plus X and then the name of the file.
Best practice, bam.
And now the color changes and we have actually execution access.
So the way that we can run this bash is done slash best practice.
And hey, it echoed out.
This class is super fun and I'm going to tell all my friends about it.
So make sure that you guys do that right.
So that's just like some basics in the syntax.
So now let's go over functions in bash.
So to create a function and bash, it's going to look like this.
You had the function name and then two parentheses and then these curly braces and then you put your
commands for the function inside of it and all the function.
You just type the function name.
It'll do the function.
So if you want to create a function that takes in an argument from the command line, so you just get
the function name again and then echo.
So here we have Echo.
This is the random number today is and then it has signed one so that on one sets the argument given
that the command line to that variable.
Right.
So whatever the first argument that you input at the command line after you put dot slash and then the
filename and the space and maybe you type in something else, like you type in like a random number,
it would actually use that as the variable.
And we can you for this one specifically, we could just use the random variable which is in Gibby and
Linux by default, and you'll be able to just pass on a random number.
So let's actually go and try to make this OK.
So I'm just starting to follow the bash function.
So remember, we have to start with the policy points has been bash and then we can go down.
So I don't want to do as going to set a variable equal to our first argument that we're going to pass
in.
So numbers that equal time once and now, the name of our function, which would be pass argument,
I say that parentheses and curly braces.
So now say echo today's user provided no is
and then you can put no.
There we go.
Right there.
So Cityscape quit.
Well actually sorry.
Before we do that, of course we have to call the function which makes sense.
So let's go ahead and call the function.
So pass argument is all you have to do is makes quit, give execution access.
Sejima plus Xpress function there.
Oh so dot slash function and let's say seventy six five for every go.
Today's provision provider number is seven six five four.
So now you know kind of like the basis of creating a functioning Basche.
OK, so now let's go over capturing user input.
So the input from user and stored as a variable we would use the Grand Redzepi, whatever text you want
to print out, and then a variable name and read input from user solidly from passwords stored is variable.
You would say redoes Espie.
They need this X you wanted to print out and then followed by the the variable name.
OK, so now let's go try this out really quickly.
OK, so I'm going to start a new file, the C v input.
Keep it simple.
So let's put our command here first slash bash.
So now let's do read the SPI username, keep the symbol and per user as the variable when a star dies
and read Espie password pass W.D..
So now we have we can echo these because the story's variables now.
So let's say now this echo, you know.
Thanks.
Or say thanks and then username, so say thanks, user, your password is now password.
There you see my plus X and puts type wrong sige plus X inputs.
Got such input.
Not as from your username.
So Anthony password.
Password.
Thanks Anthony.
Your password is not password they so now you're not taking user input.
And I'm just going to give you guys an example of, you know, a conditional statement in Basche really
quickly.
So when you see, you know, dash alti that means less then.
And then if you see Dash G.T., that means greater than.
So this one is asking you.
So it takes your input, ask you how old you are.
So what's your age?
And then it says if the variable age is less than 16, then you're going to echo you are young or else
if which is like saying like another if statement.
If the age is greater than 60, we're going to say, hey, we're going to print out your mature.
Other than that, we're going to go out, you're in the middle and then fee and the additional.
OK, so that's like, you know, kind of basic of that.
So and that's, you know, Basche kind of in a in a nutshell, you know, it's a lot of conditional
statements and just using a different syntax and commands to execute things that you want to do this,
it can go a lot deeper than we did and you can go out and learn that on your own.
But that's pretty much the basics of Vash.