Join Scott Simpson for an in-depth discussion in this video Working with arguments, part of Learning Bash Scripting.
…Until now, I've been writing self-contained…scripts that don't accept any input.…But in the real world, chances are you'll want to get…some kind of information from the user to use in your script.…For this, you'll use arguments.…If you're following along, you'll see that these arguments are exactly…the same as they were when you were working with functions.…If you're just joining in, I'll start with a little bit of review.…Arguments are a special type of variable that are…specified by the user when the script is run.…These could be pretty much anything.…A file or a folder you want to create or work…with, a user name, or a string or text to search for.…
They're passed into the script by typing them after the script name.…Arguments are represented by numbered variables, and they're assigned…in the order that they're provided in the command line.…So the first argument is assigned to $1.…Let's take a look at that.…Here, I'm using Apple as the first argument.…And since I'm echoing out the first argument in my script, I see Apple.…
- What is Bash?
- Managing output with grep, awk, and cut
- Understanding Bash script syntax
- Creating a basic Bash script
- Displaying text with "echo"
- Working with numbers, strings, and arrays
- Reading and writing text files
- Working with loops
- Using functions
- Getting user input during execution
- Ensuring a response
Skill Level Beginner
Linux: Bash Shell and Scriptswith Kevin Dankwardt2h 46m Intermediate
1. Working with the Command Line
2. Building Bash Scripts
3. Control Structures
4. Interacting with the User
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.