From the course: LPI Linux Essentials (010-160) Cert Prep
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Arguments - Linux Tutorial
From the course: LPI Linux Essentials (010-160) Cert Prep
Arguments
- As we've already talked about, scripts are great and they really are useful. But to really expand the utility of a script we need to use variables and arguments. Now, a variable is a placeholder for a value that'll be determined when the script runs. The values of variables can be passed as parameters to a script, generated internally to that script, or extracted from within the script's environment. An environment is just a set of variables, including things such as the current directory, the search path for running programs, or anything else like that which a program can access. Variables that are passed to the script are frequently called arguments or parameters. They're represented in the script by a dollar sign followed by a number from zero upwards. So for instance $0 stands for the name of the script. $1 is the first parameter to the script. $2 is the second parameter from the script and so on. These parameters, when…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Text files and text editors3m 55s
-
Using vi and nano8m 57s
-
(Locked)
Beginning a shell script2m 33s
-
(Locked)
Commands4m 38s
-
(Locked)
Arguments2m 35s
-
(Locked)
Variables3m 24s
-
(Locked)
Conditional expressions4m 39s
-
(Locked)
Loops and functions3m 48s
-
(Locked)
Exit value2m 17s
-
(Locked)
Turning commands into a script11m 39s
-
(Locked)
-
-
-
-
-