I wish to place my executables in subfolders:
$ tree
.
├── bin
│ ├── exec.py
│ ├── method1
│ │ ├── exec1.py
│ │ └── exec2.py
│ └── method2
│ ├── exec1.py
│ └── exec2.py
If I include bin/ folder in PATH, is there a way to access executables from my shell script (which is in another directory), as e.g.
$ method1/exec1.py arg1 arg2
The above command gives an error (No such file or directory), but
$ exec.py arg1 arg2
works, as it is not in a subfolder.
Kindly advise how I can organise executable files in subfolders. Thanks.
As documented here, the bash shell (and probably most other shells too) only looks for the command on the $PATH if the command name contains no slashes.
There are several ways you can solve the issue: