問題:
When running scripts in bash, I have to write ./
in the beginning:在 bash 中運行腳本時,我必須在開頭寫./
:
$ ./manage.py syncdb
If I don't, I get an error message:如果我不這樣做,我會收到一條錯誤消息:
$ manage.py syncdb
-bash: manage.py: command not found
What is the reason for this?這是什麼原因? I thought .
我想.
is an alias for current folder, and therefore these two calls should be equivalent.是當前文件夾的別名,因此這兩個調用應該是等效的。
I also don't understand why I don't need ./
when running applications, such as:我也不明白爲什麼我在運行應用程序時不需要./
,例如:
user:/home/user$ cd /usr/bin
user:/usr/bin$ git
(which runs without ./
) (沒有./
運行)
解決方案:
參考一: https://en.stackoom.com/question/QZ07參考二: https://stackoom.com/question/QZ07