Shell Programming - hewigovens/hewigovens.github.com GitHub Wiki

##Bash Variables Bash-Variables

Get current working directory even PWD or working directory is not set

CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

##exec [Advanced Bash-Scripting Guide:Chapter 16. I/O Redirection] (http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/x13082.html)
shell builtin,主要用途:

  1. 操作文件描述符,I/O重定向
  2. 执行其他shell脚本或者同一脚本的不同部分,可以用来实现并行执行

##subprocess Eg:

( find . -name "*.bak" -exec rm -rf {} \; ) &
( some/other/stuff ) &

wait