Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
Bash 中 $() 和 () 之间的区别
当我打字时ls l echo file 支架的输出 这只是简单的回显 被获取并传递到外部ls l命令 就等于简单的ls l file 当我打字时ls l echo file 我们有错误 因为不能嵌套 内部外部命令 有人可以帮助我理解之间的区
Linux
bash
unix
subshell
通过管道从子shell获取退出代码
我怎样才能获得退出代码wget来自子shell进程 所以 主要问题是 等于0 哪里可以 8成立 gt OUT wget q http budueba com net tee a file txt echo 0 它的工作原理无需tee 实际上
bash
pipe
exitcode
tee
subshell
为什么 tee 等待所有子 shell 完成?
我有一个运行 mysqld 的服务器脚本并分叉以继续运行 举个例子 mysqld
bash
pipeline
tee
subshell
命令替换何时会比单独的相同命令产生更多的子 shell?
昨天有人建议我在 bash 中使用命令替换会导致生成不必要的子 shell 该建议具体针对这个用例 https stackoverflow com q 21317997 313192 Extra subshell spawned foo c
bash
shell
Optimization
subshell
commandsubstitution
子 shell 进程无法访问父 shell 中定义的变量和函数
我在同一目录中有3个脚本 请找到以下x sh y sh和z sh的内容 x sh xData DataOfX function xInit echo xInit data of a gt xData lt y sh x sh xInit s
bash
function
shell
variables
subshell
为什么递归函数只遍历一个子目录
我已经找到了让我的代码正常工作的答案 但我想知道为什么它可以工作而我的代码却不能 rFunc for d in do if d d then cd d rFunc fi Do Something done 这段代码只会通过一个子目录 但如果
bash
subshell
为什么 ssh 在没有 -t 的情况下等待我的子 shell,并用 -t 杀死它们?
我有一个 bash 脚本 start sh 如下所示 for thing in foo bar do background processor thing cleanup on exit thing done 这就是我想要的 我运行 sta
bash
SSH
TTY
subshell
在 bash 中,如何从由 tee 管道传输的函数中退出脚本?
我试图理解为什么每当我使用function 2 gt 1 tee a LOGtee 在函数中创建一个无法通过简单退出的子 shellexit 1 如果我不使用tee它工作正常 下面的例子 bin bash LOG root log log
bash
function
exit
tee
subshell
Bash 使用 subshell 和 substring 进行错误替换
一个人为的例子 给出 FOO foo bar baz 这有效 在 bash 中 BAR basename FOO result is BAR baz BAZ BAR 0 1 result is BAZ b 这不 BAZ basename F
bash
string
substitution
subshell
在 bash 中用其内容替换“源文件”并扩展变量
在 script sh 中 source a sh source b sh CMD1 CMD2 CMD3 我怎样才能更换source sh及其内容 不执行命令 我想看看 bash 解释器在获取文件并扩展所有变量后执行什么 我知道我可以使用s
bash
set
expansion
subshell
如何在不创建子 shell 的情况下将命令的输出存储在变量中 [Bash
ksh有一个非常有趣的构造来执行此操作 详细信息请参阅此答案 https stackoverflow com a 11172617 636849 https stackoverflow com a 11172617 636849 从 Bas
bash
variableassignment
subshell
为什么要避免使用子shell?
我在 Stack Overflow 上看到了很多答案和评论 提到做一些事情来避免子shell 在一些 情况下 给出了一个功能性原因 最常见的是 可能需要读取变量 在其内部分配的子 shell 之外 但是在 在其他情况下 回避似乎被视为结束
bash
subshell
从子 shell 设置父 shell 的变量
如何从子 shell 中在父 shell 中设置变量 a 3 a 4 echo a 子 shell 的全部意义在于它doesn t影响通话会话 在 bash 中 子 shell 是一个子进程 其他 shell 有所不同 但即使如此 子 sh
bash
shell
subshell
从管道读取的 while read 循环后重置变量
initiate read p Location s to look for bsp files in loc find loc name bsp while read do if f loc bz2 then continue else
bash
shell
whileloop
subshell
为什么 `cat <(cat)` 会产生 EIO?
我有一个程序可以同时读取两个输入文件 我想让这个程序从标准输入读取 我想我会用这样的东西 program1 lt cat lt program2 但我刚刚发现 cat lt cat produces mmap2 NULL 139264 PR
bash
IO
stdin
subshell
processsubstitution