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.

Variables

Variables - Linux Tutorial

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

Start my 1-month free trial

Variables

Let's talk a little more about variables. Now, in addition to inputting a variable as part of the arguments for a script, you can also assign the variable within the script itself using the output of another command. These variables are identified by a leading dollar sign, but they're given a typical name that's easier to be read, something that begins with a letter. Where in the last lesson, we used dollar sign one, dollar sign two, as the first and second parameters. In this case, we're going to use dollar sign with a word to represent some other variable. These variables an be used together with normal commands as if they were command parameters as well, but the value of the variable is going to be past that command. Let's take a look at this script and see how this works in reality. Now, this script is going to check if a router is up by pinging it using the ping utility and two different variables. The first…

Contents