linux中子shell中子进程ID,用$$来表示,本文介绍一个简单的例子,来学习下这个特殊变量的用法。
shell脚本中$$指当前进程ID,而调用$()执行命令时会生成子shell。
#!/bin/bash $(test)
代码说明:
一,info bash中的说明
`$'
Expands to the process ID of the shell. In a `()' subshell, it expands to the process ID of the invoking shell, not the subshell.
二,man bash里的说明
$
Expands to the process ID of the shell. In a () subshell, it expands to the process ID of the current shell, not the subshell. (责任编辑:IT) |