Open ghost opened 3 years ago
大佬,命令替换是在子shell中执行,那为什么bc内联重定向的例子中bc还能访问var1 var2 var3 var4?
@luguoba 大佬,命令替换是在子shell中执行,那为什么bc内联重定向的例子中bc还能访问var1 var2 var3 var4?
bc并没有使用访问这些变量,而是在父shell中通过重定向的方式将这些变量作为它的输入。
@TakoTakoo
@luguoba 大佬,命令替换是在子shell中执行,那为什么bc内联重定向的例子中bc还能访问var1 var2 var3 var4?
bc并没有使用访问这些变量,而是在父shell中通过重定向的方式将这些变量作为它的输入。
懂了,谢谢大佬。 打扰了,大佬我悟了。
@livrth @luguoba https://stackoverflow.com/questions/47213250/why-echo-eof-not-working-as-expect
懂了,感谢大佬。
由于 umask 变量在 ArchLinux 中被设成了 022,所以系统创建的文件的文件属主和属组只有读/写权限。
这里写错了。应该是文件权限变成了644。属主有读写权限,属组成员及其他用户只有读取权限。
@huntagain2008 感谢你的指出
命令替换会创建一个子 shell 来运行对应的命令。子 shell(subshell)是由运行该脚本的 shell 所创建出来的一个独立的子 shell(child shell)。正因如此,由该子 shell 所执行命令是无法使用脚本中所创建的变量的。
这句 正因如此,由该子 shell 所执行命令是无法使用脚本中所创建的变量的。 是不是错了。
https://archlinuxstudio.github.io/ShellTutorial/#/shellBasic/shell_basic
Linux命令行与Shell脚本教程 包含常见命令行使用,Bash基础、高级编程,以及实用范例!