From the course: Learning Linux Shell Scripting

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Solution: Create a script

Solution: Create a script - Linux Tutorial

From the course: Learning Linux Shell Scripting

Solution: Create a script

- [Instructor] So, how'd it go? Did you complete the challenge? Here's my solution. Don't be surprised if it doesn't look like yours. Two solutions to the same problem rarely do. So, we're gonna start off in the terminal and we'll type in touch sport.sh. That creates the file. Change mode 755 sport.sh. That's gonna make it so we can execute it and finally I'm gonna edit it with atom sport.sh. Now, the first thing we're gonna do is we're gonna type in our shebang, so that's a pound sign, exclamation /usr/bin/env bash and I'm gonna add a comment in here just so I can remember what was going on. Then I'm gonna say that my first thing is a name and it is going to be equal to my parameter one. Remember, parameter zero is the name of the script, whereas parameter one is the first thing that the user typed after the name. Then ask what their favorite sport is and so, we'll just say sport equals parameter two and then we're gonna print something out, print the name and sport. Usually your…

Contents