shell中$(cd \"$(dirname \"$0\")\",pwd) 解析

BIN_FOLDER = $(cd "$(dirname "$0")",pwd) 解析:

1、取当前运行脚本的所在路径: $0

2、取当前脚本所在路径的父目录: dirname "$0"

3、取返回的父目录的值: $(dirname "$0")

4、cd到返回的父目录: cd "$(dirname "$0")"

5、输出地址: cd "$(dirname "$0")",pwd

6、取输出的地址,并赋值给BIN_FOLDER: BIN_FOLDER = $(cd "$(dirname "$0")",pwd)

相关推荐