From the course: LPIC-1 Exam 102 (Version 5.0) Cert Prep

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use Command and Variable substitution

Use Command and Variable substitution - Linux Tutorial

From the course: LPIC-1 Exam 102 (Version 5.0) Cert Prep

Start my 1-month free trial

Use Command and Variable substitution

- [Instructor] We can insert a variable into a text string or command line and have the variable value substituted for the variable name. For instance, in a terminal type, echo space, double quote, my space name, space is space dollar sign, capital U,S,E,R, double quote and hit enter. This outputs the text My name is followed by the value in the user variable. As we've seen elsewhere in this course, we need to be careful with quoting. In order to have variable substitution, we need to use double quotes. This echo command is pretty basic. Now let's use a command to process the value of a variable. To set this up, let's create a couple of variables. In a terminal type in pdir, equals double quote slash tmp slash files slash today, double quote and hit enter. Let's create a second variable called fname. fname equals double quote, report, double quote and hit enter. variable names can be uppercase or lowercase. Most system…

Contents