Why do you need ./ (dot-slash) before executable or script name to run it in bash?

前端 未结 9 1048
耶瑟儿~
耶瑟儿~ 2020-11-22 03:59

When running scripts in bash, I have to write ./ in the beginning:

$ ./manage.py syncdb

If I don\'t, I get an error message:

9条回答
  •  日久生厌
    2020-11-22 04:50

    On *nix, unlike Windows, the current directory is usually not in your $PATH variable. So the current directory is not searched when executing commands. You don't need ./ for running applications because these applications are in your $PATH; most likely they are in /bin or /usr/bin.

提交回复
热议问题