- 论坛徽章:
- 0
|
( )和{ }的区别---一个问题
是这一篇吧
http://bbs.chinaunix.net/forum/24/20040906/401274.html
摘录原贴的结论:
- $: Expands to the process ID of the shell. In a ( ) subshell, it expands to the process ID of the current shell, not the subshell.
- 所以说,正常情况下$$表示的是当前进程的ID号,但是如果用的(),则
- $$表示的是调用该命令的shell的ID。
复制代码
原贴还讨论到subshell 和nested subshell的参数继承问题,也很受教
- 1. subshell 继承
- * The current directory
- * Environment variables
- * Standard input, output, and error plus any other open file descriptors
- * Any characteristics defined in the environment file
- * Signals that are ignored
- 2. subshell 不继承
- * Shell variables, except environment variables and those defined in the environment file
- * Handling of signals that are not ignored
- 3. nested subshell 和一般 subshell 完全一样, 除了它继承父 shell
- 的 Shell variables 以外。
复制代码 |
|