I want to execute graldew. It is definitely in the same directory and it has all the permission. But when I try to execute it I get command not found. Also I can not even autocomplete it using TAB button.
Asked
Active
Viewed 2,008 times
1
Kosh
- 238
2 Answers
2
It is definitely in the same directory
Unlike Windows, the command-line shell in macOS (and other Unix-like systems) only executes commands found in $PATH and doesn't give any special treatment to "the same directory" – and the current directory is not in $PATH by default.
Files whose location isn't in $PATH can only be run using their exact path: ./gradlew will work for files in the current directory (i.e. .), though full /Users/..../android/gradlew or $PWD/gradlew can be used too.
It is also possible to add . at the end of $PATH, though generally not recommended. (Adding it at the beginning, like in Windows, is very risky as downloaded files could override system commands such as 'ls' or 'rm'; having it at the end – a bit less so.)
grawity
- 501,077
