学习shell编程 – 8.shell的退出、进程及子shell

#结束程序,成功退出
exit 0

#失败退出,将约定的某个数字返回给shell
exit 100  # 执行“./hello.sh; echo $?”,就可以看到100

#打印本脚本执行时的进程ID
echo pid=$$

########################
#子shell
x=100
(#括号里的将在子shell里运行 
 echo $x #将打印100
 y=900
)
echo $y #打印空                     


Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.