⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex43.sh

📁 一本完整的描述Unix Shell 编程的工具书的所有范例
💻 SH
字号:
#!/bin/bashy=`eval ls -l`  #  Similar to y=`ls -l`echo $y         #+ but linefeeds removed because "echoed" variable is unquoted.echoecho "$y"       #  Linefeeds preserved when variable is quoted.echo; echoy=`eval df`     #  Similar to y=`df`echo $y         #+ but linefeeds removed.#  When LF's not preserved, it may make it easier to parse output,#+ using utilities such as "awk".echoecho "==========================================================="echo# Now, showing how to "expand" a variable using "eval" . . .for i in 1 2 3 4 5; do  eval value=$i  #  value=$i has same effect. The "eval" is not necessary here.  #  A variable lacking a meta-meaning evaluates to itself --  #+ it can't expand to anything other than its literal self.  echo $valuedoneechoecho "---"echofor i in ls df; do  value=eval $i  #  value=$i has an entirely different effect here.  #  The "eval" evaluates the commands "ls" and "df" . . .  #  The terms "ls" and "df" have a meta-meaning,  #+ since they are interpreted as commands,  #+ rather than just character strings.  echo $valuedoneexit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -