课程: Linux CentOS 7: Shells and Processes

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Command and variable substitution

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 USER, double quote and hit enter. This outputs the text my name is followed by the value and 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…

内容