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 - Linux Tutorial
From the course: LPIC-1 Exam 102 (Version 5.0) Cert Prep
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…
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
-
-
-
-
Introduction to Bash2m 9s
-
(Locked)
What is a shell script?3m 57s
-
(Locked)
Execute compound commands5m 59s
-
(Locked)
Use Command and Variable substitution6m 21s
-
(Locked)
Conditional flow with if, then if3m 12s
-
(Locked)
Conditional flow with case2m 21s
-
(Locked)
Iterate with for loops2m 42s
-
(Locked)
Iterate with while loops1m 30s
-
(Locked)
Using return codes6m 32s
-
(Locked)
Create a monitor script3m
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-