我正在嘗試source
的Firefox addon sdk。爲此,我必須將cd
放入sdk的目錄中,然後運行source bin/activate
。如果我不cd
到該目錄,並直接從我在目前任何路徑源,會發生以下情況:別名從另一個目錄中獲取bash文件並返回到當前目錄
$ source ~/src/devtools/addon-sdk/bin/activate Welcome to the Add-on SDK. Run 'cfx docs' for assistance. $ cfx -bash: cfx: command not found
我想爲這一個別名,它的CD到SDK,貨源它,然後返回到我的當前目錄:
alias acfx='cd ~/src/devtools/addon-sdk && source bin/activate && cd "$(dirname "$0")"'
這正確源的SDK,但很可惜沒有返回目錄我調用的別名:
$ acfx Welcome to the Add-on SDK. Run 'cfx docs' for assistance. dirname: illegal option -- b usage: dirname path
我迷路了,我該如何回到原來的目錄?或者爲source
指定一個「工作目錄」?
僅供參考,如果將SDK的'bin'目錄添加到$ PATH中,則可以在不需要activate/virtualenv-esque環境的情況下以這種方式運行cfx。 – canuckistani 2013-04-09 05:12:02