In this course, you'll learn how to create new user accounts. In that script, you're going to make sure the person who executes the script has the proper privileges to do so and you're going to make sure the specified account was created successfully. After that, you're going to expand it and make it better by automatically generating random passwords, accepting command line arguments, and so on. You'll learn all the concepts and techniques to build that script and complete your first project.
This course is part of the Linux Shell Scripting learning path. To follow along with this course, you can find all the necessary resources here.
Learning Objectives
- Get started with naming, permissions, variables, and built-ins
- Learn about special variables created by the shell, how to store the output of a command in a variable, and learn about if statements
- Learn about exit Statuses, return codes, and string test conditionals
- Learn how to get input from the person executing the script and how to create an account on a Linux system
Intended Audience
- Anyone who wants to learn Linux shell scripting
- Linux system administrators, developers, or programmers
Prerequisites
To get the most out of this course, you should have a basic understanding of the Linux command line.
Before you jump in and start learning the ins and outs of shell scripting, I wanna take just a minute to tell you what to expect over the next few lessons. The first shell script you're going to write in this course creates new user accounts. In that script, you're going to make sure the person who executes the script has the proper privileges to do so and you're going to make sure the specified account was created successfully. If for some reason, the account creation process fails, you're going to let the person running the shell script know. That's the first milestone you're working toward. After you complete that initial script you're going to expand it and make it better by automatically generating random passwords, accepting command line arguments, and so on. Now that you know what you're trying to accomplish, you'll need to learn all the concepts and techniques to build that script and complete your first project. Having a goal in mind and a project to implement will actually help you learn and retain the material, instead of me just randomly teaching you some commands and throwing various shell scripting tips at you, and then leaving it up to you to imagine when you might use those commands and techniques, you'll actually understand how, why, and most importantly, when to use everything you're taught. You'll start out using these new skills to accomplish meaningful work in a relatively short period of time. With that said, over the next four lessons I'm going to be performing some demonstrations and doing a good bit of teaching, but just know that everything you're introduced to is needed in order to write and use that first script. If you are itching to dive in right away you can follow along with me during those lessons. Keep in mind if you do that you're probably going to be making good use of the pause button to give yourself enough time to type up the scripts, try out the commands and so on. By the way, all the scripts you'll see in the lessons are included in the course download, so you can quickly refer back to them without having to rewatch the entire lessons. If you choose to simply watch and absorb all the information coming at you during the next four lessons, that's perfectly fine too because you'll get to practice those skills while working on the first scripting exercise. After those first four initial lessons you're going to get some very clear instructions on what the shell script should do and how it should work. Then you'll go off and write and test that shell script on your own. Of course, you can refer to any of the previous lessons and demonstration scripts to help you complete that script. After you write your script you'll get a chance to see me work through the exact same exercise. You'll look over my shoulder as I write the shell script. So that's what's in store for you. All right, enough background information, let's get to scripting.
Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.