 Today in our shell script, we're going to be looking at exit codes. I'm working in bash, but this should work in pretty much every shell out there and Basically whenever you write a command in the shell when that command ends or program ends running It outputs an exit code that you don't necessarily see to the screen, but you can check And in most cases, it's either zero or one meaning true or false It could be others there are a few others, but most cases it's going to be zero Saying that it's true and it is successfully or one that it's false at or that it ended in an error Or unsuccessfully, I guess you'd say so real quick. Let's create a variable here. I'm going to say x equals cat We can check that by saying echo dollar sign x and it should output cat which it does Now let's check the exit code or let's check the value of that and then check the exit code to see whether it was true or not Now obviously we can write out a full if then statement Well, we can shorten it up here just by using our brackets here Bracket space, which is important to have that space there dollar sign x equals Inside quotations cat and then whoops a space between that Quotation and the bracket there, so I'm going to hit enter and we get no output, but basically it's checking Does the variable x equal the word cat the string cat? This case it does so we should get an exit code of zero and the way we check that is we say echo Dollar sign question mark and hit enter and you can see here that we got a zero and that's just saying What is the exit code of the last command that finished running? now if we Hit up arrow a few times to go back to our previous commands. We can change this and change this to dog So I'm saying check does x equal Dog which it shouldn't so I'm gonna hit enter here once again We don't get any output, but there was an exit code So if again, we say echo dollar sign question mark it checks the exit code of the last command ran So I'll hit enter there and this time we got a one meaning false It did not successfully check that I mean it did successfully check that the value But x does not equal dog once again. There are other error codes, but those are the two most common so That's a great way to check stuff We're gonna get into that a little more in the next few tutorials on our shell scripts But that's just a quick look at that and I thank you for watching. Please visit films by chris comm That's chris of the K. There should be a link in the description Go there to search through all my videos and playlists I thank you for watching and I hope that you have a great day