课程: Linux: Bash Shell and Scripts
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solutions: Scripts with exported variables, sourcing, and echo - Linux教程
课程: Linux: Bash Shell and Scripts
Solutions: Scripts with exported variables, sourcing, and echo
- [Narrator] Let's look at how to do these scripts, scripts to look at some variables, and some options for echo. So first of all, we want to print out A. So, I've got a little script here. Pretty simple. Right, just says echo A is and then the value of A. Just to make sure we don't have a variable A, we're going to unset it, and we're going to run our script and we got A is nothing. Now, we're going to say A equals one on the command line, and we're going to run again. We didn't export A, so again, in the shell, A doesn't have a value, but now we're going to export A, and when we do it, we're going to give it a new value. A is two. Run the script again. And now the script gets a copy of A because it's exported and it could print out that A is two. We'll tell the script set.sh, that assigns a value to A, A is ten. So we've already exported A, but just to make sure, we'll export it again, and we're going to say, A equal five. We're going to run, set.sh. We're going to echo the value of…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
Exploring the Bash documentation1 分钟 57 秒
-
Setting the script interpreter and permissions6 分钟 29 秒
-
(已锁定)
Time commands and set variables9 分钟 10 秒
-
Bash startup4 分钟 28 秒
-
(已锁定)
Sourcing and aliasing with bash5 分钟 34 秒
-
(已锁定)
Displaying text with the echo command4 分钟 10 秒
-
(已锁定)
Challenges: Scripts with exported variables, sourcing, and echo2 分钟 6 秒
-
(已锁定)
Solutions: Scripts with exported variables, sourcing, and echo4 分钟 20 秒
-
-
-
-
-