Shell中如何准确获取当前脚本的目录

推荐方法:

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

其他用$0神码的方法可能会有问题。

Leave a Reply

Your email address will not be published. Required fields are marked *