 Well, we have been working with bash scripts, shell scripts, and working with if-then statements, and so far we've done if-then statements with integers, which are numbers. Well, today we're going to start working with strings, so you can get things like user input as far as names is what the example I'm going to use today is. I have deleted the script that we have been working with, so we're going to create a new script. Once again, I'm going to be using Vim as my text editor. Vim is just my personal preference for text editors for writing scripts. You can use whatever text editor you like, vi, nano, gedit, kwrite, kate, as long as it's a text editor and not a word processor that will cause all types of problems for you. So I'm going to call my script myscript.sh, and in this first line I'm going to do my shebang line, which just tells the computer what type of script this is and what interpreter to use. In this case, it's a bash script, so we're going to say pound, exclamation mark, forward slash bin, forward slash bash, which is basically saying run bash and then send it these commands. So first thing we're going to do, I like to always start off my scripts by clearing the screen. It just makes things look nice. And then I'm going to echo out to the user a question or ask them to do something. I'm going to say enter your name. And in this case, I'm using a dash n because I want to not have a new line character at the end of this. It's just personal preference for this particular script. So when they enter their name, it's going to be placed over here rather than on the next line. Next, we're going to issue the read command and ask for it to grab the user input and put it into a variable called name. Now we're going to start our if then statement. In the previous tutorial, working with integers, we would have done it like this. We would have said if the variable name and then we said dash eq for equals and then we would say something like chris. And that's how we would get check to see if name equals chris. But since we're not working with integers, there's two things we need to change. Instead of eq, we're just going to say equals. So checking to see if the name equals this. And since we're checking a string, we're going to want to put our string in quotations. So if the name does equal chris, we're going to say then do something. I'm also going to close my if statement now so I don't forget later with fi, which is the reverse of if. That's how you close the if statement. That means that's the end of the if statement. So I'm also going to go up here. Once again, just my preference. I like to clear the screen every so often, so I'm going to clear it right here before we do our if then statement. So get the username after they enter, it's going to clear the screen and then check if what they inputted equals chris. If what they entered does equal chris, we're going to say echo and we're going to say hey buddy, we will save that. Since this is a new script, we're going to have to change it and make it executable. So change mod plus x for executable and the name of the script. And now we can run the script. Since it's in our current folder, we're going to give it a dot slash. That just means in this folder, run this script. And once again, I'm hitting tab to autocomplete. So I type in for beginning of the name and then hit tab, it will autocomplete. We'll enter. First part of our script clears the screen, asks a question. If I type in chris and hit enter, it says hey buddy. If I run it again and I type in something like bob, I get no output because we haven't put anything for anything other than chris into our script. So once again, I can run this. I can type in chris, it says hey buddy, run it again, I'll type in tim, nothing. It just clears the screen, which is before if statement. It's going back in here. We're going to add some other things here. We can add in our else part of this and it will echo, I don't know you. Now I save it, run it again, ask for a name once again, if I type in chris, it says hey buddy. If I run it again and type in bob or anything other than chris, it will say I don't know you. And of course, if you have more than just one person you want the computer to recognize, we can say if, I'm sorry, L if since this is still part of the same if statement, we will say check again, name, if name equals gen, we'll say then echo, hey girl. So quickly looking over this, we're saying this is a bash script. Use bash as the interpreter to read this script. We're going to clear the screen and then ask a question, we'll ask for the name. Read will wait for the user input, whatever they enter in, it will put it into the variable name. We're going to clear the screen again, just to keep things looking nice. Now we're going to check if the name that the person entered equals chris, then we're going to echo, hey buddy. I also want to stop and say don't forget this has to be space just like this, with the space there, space there, space there, space there. If you forget the space there, probably going to get an error. Same in the other spots. So if the user enters chris, it will say hey buddy, then we're going to check, well, if it doesn't chris equal chris, then else if it equals the name gen, then it will say echo, hey girl. And if it says else, echo, I don't know you. So if it's anyone other than chris or gen, it's going to say I don't know you. So we'll run the script again, once again, even though we made changes to it, we don't have to make it re-executable because it's already executable because it's still the same script. Enter the name, if I enter chris, it says hey buddy. If I run it again and type in gen, it says hey girl. If I run it again and I enter bob, it'll say I don't know you. Or if I enter blah blah blah, it'll say I don't know you. So that's if then statements with strings. We obviously have more tutorials coming up on if then statements. And one of the next things we're going to go over is a case like this. So we run the script we just created, and I've been typing in chris, but what if I put chris with a lower case k? Remember, Unix-based operating systems are going to be case sensitive, meaning a capital k and a lower case k, or whatever letter it is, is not the same as the other version of it. So a lower case k is not the same as a capital k. So if I type in chris with a lower case k, it says I don't know you because it doesn't realize that chris is chris because of the case sensitiveness. So if you've been watching my tutorials over the last week or so, you probably know where I'm going to go with this or at least have an idea. But in our next tutorial, we will fix it or change it so that it will always be the same regardless of how the case of the name is entered by the user because you never know what a user is going to enter and how they're going to enter it. So I hope you enjoy this tutorial. I hope you look forward to the next tutorial. Please visit filmsbychris.com. That's Chris of the K. There should be a link in the description. And I just thank you for watching and hope that you have a great day.