亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標題: ( ) 與 { }不理解的地方. [打印本頁]

作者: hellolinux    時間: 2005-06-07 09:32
標題: ( ) 與 { }不理解的地方.
ls
1
cp 1 2 && ( echo "yes" ; ls )
yes
1  2
ls
1  2
cp 1 3 && { echo "yes" ; ls }  回車出現(xiàn)>
>

( )和{ }到底有何區(qū)別,看書說()是在當前shell中執(zhí)行,{}在子shell中執(zhí)行.
在子shell中怎么不能執(zhí)行第二個命令 ?
作者: icesummit    時間: 2005-06-07 09:59
標題: ( ) 與 { }不理解的地方.
() is for command group. A listing of the commands will ben exectued in subshell.

{} Sometimes it is called "inline group". Actually, it creates an anonymous function. However, it is different to a function, the variables in a code block remain visible to the remainder of the script.
作者: guangzongy    時間: 2005-06-07 10:37
標題: ( ) 與 { }不理解的地方.

  1. ls
  2. 1
  3. cp 1 2 && ( echo "yes" ; ls )
  4. yes
  5. 1  2
  6. ls
  7. 1  2
  8. cp 1 3 && { echo "yes" ; ls; }
復制代碼

作者: chenzq1604    時間: 2005-06-07 11:46
標題: ( ) 與 { }不理解的地方.
不知道跟封閉有無關系?
作者: zleil    時間: 2005-06-07 14:29
標題: ( ) 與 { }不理解的地方.
原帖由 "hellolinux" 發(fā)表:
ls
1
cp 1 2 && ( echo "yes" ; ls )
yes
1  2
ls
1  2
cp 1 3 && { echo "yes" ; ls }  回車出現(xiàn)>
>

( )和{ }到底有何區(qū)別,看書說()是在當前shell中執(zhí)行,{}在子shell中執(zhí)行.
在子shell中怎么不能..........

() 是在子shell
{ } 一組腳本,類似c語言中的程序塊
作者: 寂寞烈火    時間: 2005-06-07 14:56
標題: ( ) 與 { }不理解的地方.
{ cmd1;cmd2;...cmdN; }
作者: 網(wǎng)中人    時間: 2005-06-07 15:07
標題: ( ) 與 { }不理解的地方.
若有空, take a look at:
http://www.72891.cn/forum/viewtopic.php?p=1595135#1595135




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2