统计代码行数
find . -name "*.m" -or -name "*.h" | xargs grep -v "^$"| wc -l
获取脚本所在的路径
cwd=$(cd $(dirname ${0}); pwd)
跨行字符串
a="aa
b c
def"
echo $a #错误
echo "$a" #正确
正则表达式
# 存在连续的non-space字符
if [[ $line =~ [^\[:space:\]]+ ]]; then echo ${BASH_REMATCH[@]}; fi
# 存在连续的space字符
if [[ $line =~ [[:space:]]+ ]]; then echo ${BASH_REMATCH[@]}; fi