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

Arguments - Linux Tutorial

From the course: LPI Linux Essentials (010-160) Cert Prep

Start my 1-month free trial

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…

Contents