得到腳本所在文件的路徑

運行以下腳本能夠得到腳本所在的文件夾的路徑,若是腳本爲軟連接,則得到實際文件所在的文件夾路徑。web #!/bin/bash SOURCE=${BASH_SOURCE[0]} while [ -h $SOURCE ]; do # resolve $SOURCE until the file is no longer a symlink DIR=$( cd -P $( dirname $SOUR
相關文章
相關標籤/搜索