 If you've been following the channel for any amount of time, you'll know that I'm not what you would call a professional Bash Scripter. I'm not very good at it. In fact, I think if you were to describe my level of ability in Bash Scripting, you would use the term Rank Amateur. And I would agree with you. I'm not a very good Bash Scripter. I'm slowly getting better under the tutelage of Terminal 4 Life. And I don't know if you know this, but Terminal 4 Life has some really awesome Bash Scrips. And one of those Bash Scrips is called AutoExec. That's the script we're going to be taking a look at tonight. And I just want to start this off by saying that the way I'm going to be looking at this is going to be from the perspective of a noob, because that's the only perspective I can really use. And the power of AutoExec far outpaces the level of difficulty that I can currently use in terms of Bash Scripting. That's not quite the way I should put it, but the script itself can do way more than what I can throw at it. Let me just put it that way. I'm going to be demonstrating some of what AutoExec can do, but I want you to keep in mind that it can do so much more. And I will link to several videos of TFLs that will help you along in terms of what AutoExec can actually do. But if you're a noob Bash Scripter, AutoExec is really cool because it allows you to monitor what your Bash Scrip is doing live. It's basically a script that autointerprets the Bash Scrip that you're editing. And it's really, really cool. So let me show you three examples of what I've been using for in the last couple of days. And these are very, very, as I said, amateur or beginner scripts that I'm going to be showing you. So just keep that in mind. So let's go ahead and jump in. So what I've decided to do is show you the scripts and how AutoExec works. And then I'll show you the page where you can actually get AutoExec and how to install it. It's really easy. It's just a copy and paste of one line. And at least so far I haven't found a distribution that doesn't work on it. It works on Ubuntu for sure. That's what it was created for. It works on Debian and it works on Arco. So I'm assuming that it will work pretty much on whatever distro you're using it as. And that one line that TFL has to install it is very easy just to copy and paste and run. And it will just work just like it should. So if I do an LS here, oops, I got to go into the right folder, of course, before I can do an LS. And we do an LS here. I have three scripts. The normal hello world one, you can pretty much guess what that one does. I have one for I've been working on with if statements, and I have one that I've been working on with while loops. So first, let me just go ahead and run them into hello world. As you can see, that does exactly what the title would suggest that does it echoes hello world. It's literally the first thing you learn in any programming language, no matter what the level of programming language it is. That's what you learn. Hello world or whatever. All this will do is print out the words hello world. So auto exec does is if you run this via the alias that comes set up. Once you've installed auto exec, you can also do auto exec like that if you want. Or you can just use a E and then you give it the you give auto exec either the path of the bash script or just the bash script file name if you're in that directory. So in this case I am I am in that directory. So I can just do hello world that sh actually not actually in that directory. So I got to do CD into tutorials. Okay. Now I can do a hello world and I can just run this and you can see it says hello world. Just like you would expect if you just ran the script. Now where the power of this comes in is that you can make changes. So let's just say I wanted to change the word world and just say hello. Sudoers. I can save this. And as you can see auto exec automatically changed it to what you would expect it to output if you ran the script. So that is really cool. Right. It automatically runs the script while you're still basically editing it. Normally if you wanted to do this you'd have to write and quit out of this. You'd have to dot slash hello world.sh and it would then output the output of the command or output of the script. But with auto exec you can actually go through and have it do this live. So if we then back into hello world.sh and we change this to something different. So to say hello terminal for life and then save this again again it changes just like you'd expect it to. That is obviously the most simple use of auto exec that you can imagine. But it kind of gives you an idea of what it could do because this work was with any batch script. It works with Perl scripts. It works with Python although it didn't work with the Python script that I have for whatever reason. But it should work with Python. So the GitHub page basically says it'll work with quite a few languages. And that's great if you're learning Python or you're learning Perl or you're learning whatever. You can have this set up and as you go through and make changes to your script you can have the output to auto exec. And you can monitor the output of the script and it will actually tell you let's just say I have an error here. Let's just delete the quotation marks and we'll see what this comes out with. We should get an error and we do see it actually shows you that I have an error and what line it's on live while we're there. And if I go through and actually fix this if I get back into the proper focus. And I save that. We should go back to having it work just fine and it does. So as you can see you can see how powerful that could possibly be if you're doing even just the simplest of scripting no matter what language you're using. So let's go ahead and take a look at one of the other scripts something that's a little bit more complicated than just using a simple echo echo command. So I'm going to quit out of auto exec. You can do that by hitting control C. That's just the exit command. And then I'll get out of this here and we'll them into ifs.sh. Now I have an ifs statement here and I'm really proud of this ifs statement because I'm finally learning what this stuff actually means. Before I could just go to whatever website and copy and paste it off from someone else and you know it would work but I would have no clue what it was actually doing. But I'm finally getting to the point where I can say you know what this is what this does and understand it. So if they say the best way to learn something is to teach it. So I'm going to actually walk you through with this little if statement does. So if the input of the command is greater than 100 then it will print whoa big number bro. Otherwise it will print out that's a puny number you have there and then it just ends the if statements. So the way this works let me open up auto-exec again and this is called ifs.sh. It will actually tell me that I made a mistake. So what mistake did I make? This particular script requires some kind of input from the users. So if I get out of auto-exec and run that again but give it the number 150 it's going to say whoa big number there bro. And that fits the if command just fine. If I get out of auto-exec again and give this the number 99 it will say that's a puny number you have there. So the user input part of it is something that you'd have to exit auto-exec and then get back into. But if I were to make a change here so we give this last number that we gave it was 99. So if I went up here and changed the 100 here to 85 and then save this it'll actually change what the output is to whoa big number bro. So that's how if statements work in auto-exec. It does the test here and then it prints this. If it is true if not that's not true it runs this. And again you can imagine if you have a much longer bash script or whatever script and you have several of these things it will actually run through these things live from whatever input that the script necessitates. It's really really cool. So one more example, while loops. Now I'm very much a noob when it comes to while loops. So I'm going to them into my while loop here and I'm going to see once again if I can explain this to you. So I've set a variable v equals zero. So I've done while variable is less than or equal to 10 do the following echo number and then the variable. And then we're going to increment the variable one at a time until this is no longer true and then it's going to exit out of the loop. So that's how this particular while loop functions and I'm very proud of myself for being able to explain that. So let's go ahead and run auto exec on wiles.sh and as you can see this actually works. It goes through and lists out the numbers zero through 10 and then it exits it's just done. Now let's make a go ahead and make a change if I set this variable to five it should only print out a few numbers. So it does 5, 6, 7, 8, 9, 10 because that's how long that while loop will run because that's how long v is less than or equal to 10. So that's how while loops work. So that's auto exec and I'll show you how to install in just a second. But just to kind of summarize what this is for is it's a live it gives you the ability to see the edits of your scripts live. And it's really, really cool and it's really, really powerful. But like I said at the beginning, I've only just scratched the surface. So I'm going to leave a few links in the video description to Terminal for Life's channel where he talks about auto exec. And you'll be able to see some of the stuff that he does with it and it's just going to blow your mind. It's going to make the stuff that I did here just seem very, very amateur. But you can also see if you're just learning something how this can also kind of help you up because it's going to tell you automatically if you have an error because it's running live. And you'll be able to see if you have success because if it goes through and does what you expect it to do, you'll see the output. It's great. So if you want to install auto exec, you need to head to Terminal for Life's GitHub. Terminal for Life's GitHub here in the extra repository and it's under source. And I'll leave a link to this in the video description as well. And basically how you install it is just by copying this one command. If you don't have curl install, he gives you the option of using Wget. Chances are if you probably, if you don't have one installed, you have the other installed. But just go ahead and do sudo apt install curl. There are many things that you can use curl for. So you probably can just install it. It's very easy. You can also do that in our sudo pacman dash capitalist curl. Like I said, curls use for many things. So installing is not going to hurt you. And then you can just copy and paste this command, go to a terminal, paste it, and then hit the enter key. Now I'm not going to run it again because I've already obviously installed auto exec. But if you just do this here, it's going to automatically run the auto exec installer. It will set up the alias of AE so that you don't have to type it out automatically. You can just use AE and then you can just run it on whatever scripts you happen to have. Now what I'm going to show you before I go is how this runs on things that aren't bash. So if I do an LS here, I have a script called TLC dot PL. Now this is a pro script that was written for me by terminal for life that shows my current YouTube subscriber count. And if I just run this, it actually just outputs my current subscriber count. That's all it does. But if I go through and let's just show you what the script is, I don't know anything about pro. So I can't tell you how complicated or uncomplicated this is. It looks like rocket science to me. But it's cool. So if I go ahead and run auto exec on this, you can see it just goes through. And outputs the same thing that the script did when I just ran the script in the terminal. And I'm not going to make any changes because I don't want to mess it up. But if you're a Perl developer or you're just getting into learning Perl, you could go through and do the same thing you could do with bash in this. And you can do it with other languages as well. So you can see how very powerful this could be if you're not only learning or even if you're not learning, you're actually scripting and you want to have a live output of your script or your program. So if you're any type of scripter or programer out there, I would definitely say go check out auto exec. You can find the link description below. Check out Turner for Life's channel. He does a ton of this stuff for scripting in Perl and bash. You won't be sorry. Again, link in the video description below. Thanks everybody for watching. If you'd like to contact me, you can do so at the Linuxcast. You can support me on Patreon at patreon.com. Before I go, I'd like to take a moment to thank my current patrons. Devon, Chris, East Coast Webgent, who is fun too. Marcus, Maiklin, Sven, Jackson, Knife and Tool, Joshua Lee, Mitchell, Art, Sinner, Merrick, Camp and Mr. Fox. Thanks everybody for watching. I'll see you next time.