 Well, and welcome. This is the script we wrote in the last video that calculates the days until Christmas. Actually, the days, hours, minutes, and seconds until Christmas. And originally named this XMS underscore one because I was going to make a second script, but I'm just going to modify this script instead of creating a whole new script. And I'm going to do a little bit of cut and pasting here just to save time. I'm going to put a note at the top of this script here, like so. We are going to be using a program called toilet. Check out my videos. I've done videos. There's toilet and figlet, which are both very similar applications. And toilet has to be installed to use it. But to put it simply, if I make sure toilet is installed by running this command, I can then say toilet and I kind of use it like echo and I can say hello world. And in this case, it's kind of ugly. That's the default, but you can do different types of ASCII style text on the screen. Figlet and toilet both are useful. I felt like toilet. I think it was, even though it's a funny name. I think some of the default or the presets they have look a little bit nicer. You can do colored stuff, metallic looking stuff, all with ASCII art in your shell. Let's go back into our script here. So I'm just putting a note in here. I've done in the past where the script can check since I'm not creating like a dead package for installation. This is just a self script. In the past I've done check if this file exists. If it doesn't, then try running apps install this, which would work on Debian based systems. But if you're using something other than app, it won't work, blah, blah, blah. It's just what I feel like doing today and I don't feel like doing that. But I am going to now check if the user, so basically this script is going to work like the previous one or you can tell it to use toilet if you want fancier text. So you can have plain text or the ASCII fancy art. So basically the way we're going to do this is real simple and just say, hey, if the user gives an argument toilet as the first command, the first argument after they run the command. Well, then we are going to set toilets equal to true. Perfect. Okay. Now we're going to then go into our main loop. And right now our main loop prints out this text. We're going to move that to another function. Let's go ahead and grab this starting here. Oops, we'll leave the sleep command there. Let's do D to pull those lines. And then I'll go P to paste them here. And I'm just going to call a function and I'm going to call that get time. Okay. So when you run this command, it is going to get the time and that text output. But we want to put that output into a variable. We'll call it output equals. And as we talked about previously, actually all the time, if we wrap our command in a dollar sign parentheses, now it's running that command and putting the output of it into that variable. Great. Now let's go ahead and run that command inside our main loop here. That's actually let's put our clear and main loop up here. And then I'm going to say get time. Perfect. So we're looping, we're going to get the time. And then we're going to have another function in here. And I'm just doing things in functions. Lots of times people don't do the shell scripts. I didn't for years. I'm starting to get in the habit of it. Now we're going to do create another function called print output. Okay. And here we're not going to do an if statement. We're going to say if. And again, spaces are important here. Make sure you have them where I have them, or this will not work properly. Then, and it will say else, it will say if. Great. And what we're going to do is, if toilet is true, which is set by the user at the beginning of the script, we're going to run the toilet command. Again, toilet has to be installed. We're going to do filter, metal, and we're going to do dash F SMB lock. And we're going to pass it the output text. This is going to be rough. Obviously, you can play with this to get the look that you want. But we're going to do another filter of border. And we're going to do metal for that. So this is saying if toilet is such true by the user, use toilet. Otherwise, just echo the output. And we have to add that. So after we get the time, we'll run our function of print output. And I think we're good. I think I got everything written properly. I'll run that script now. And you see, if you don't tell it toilet, it gives us our plain text here. If I kill that and then type in toilet. Now, toilet is an unrecognized option filter. Ah, I typed filter. I forgot the T there. I'm like, I know I have the toilet installed. Let's try that again. Filt our command with toilet. Not the prettiest. It was just one of the templates they had in there. A little hard to read. But you can see now we have 90 days, 14 hours, 16 minutes, 42 seconds until Christmas. And of course, you can play with that again. Look at toilets options to get a better look at that. But if you wanted to have your countdown timer look a little bit nicer in the shell, this is one way of doing it using toilet or figlet. But I thought I'd share that. You know, things that we added or changed from our previous is we split some things off since we're going to be doing the output in two different ways to ping on the user. We did a check for what the user gives us up here. And then we split our getting the time and outputting it to two different functions, which makes it nice for, you know, again, you don't have to use functions. I just think it's a little bit easier to read when you're, when you do that. Anyway, thanks for watching. Please visit filmsbychris.com. That's Chris the K. There's a link in the description. As always, I hope that you have a great day. Support me on Patreon. Please.