From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Solution: Exported variables, sourcing, and echo - Linux Tutorial
From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation
Solution: Exported variables, sourcing, and echo
(upbeat electronic music) (upbeat electronic music ends) - [Instructor] Let's look at solutions to these challenges. So I'm in the lab exercises, ch01 directory, still, and you should have these files, and they correspond to the questions we have. And let's take a look. So the first thing we were supposed to do is write a bash script with the shebang inside that prints variable A. So we've got something that does that. And then it says, you know, give it execute permissions. So we could do change mod plus X prA.sh. Then it says, run your script without defining or setting a variable in your shell. So I'm going to unset A, in case I had one, to make sure it's not set. And then we're going to run it. A is, and it doesn't have a value, so it just says nothing. Then it says, run it again after setting A equals one on the command line. So we'll say, A equals one and just to check, yeah, it's one. Now, we run the script again. Still, it doesn't print anything because our script didn't get a…
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
-
-
-
Exploring the Bash documentation2m 27s
-
(Locked)
Setting the script interpreter and permissions5m 49s
-
(Locked)
Date and time commands5m 36s
-
(Locked)
Shell variables4m 28s
-
(Locked)
Bash startup2m 52s
-
(Locked)
Sourcing and aliasing with Bash3m 31s
-
(Locked)
Displaying text with the echo command4m 12s
-
(Locked)
Challenge: Exported variables, sourcing, and echo2m 17s
-
(Locked)
Solution: Exported variables, sourcing, and echo4m 7s
-
-
-
-
-