0

I've got a folder: /root/Desktop/commands/
This folder contains many Python scripts that should be callable from anywhere from the terminal. How can I make it, that I say once, that all scripts in this folder should be executable (without the "python" prefix of course)?

All I know is, that you have to put the file with a shebang and without the file-ending into /usr/bin/ and make it executable (chmod +x FILENAME)

In Windows, for example, you can easily put the path (f.e. c:/User/Desktop/commands/) into the environment variables (-> "PATH"). Then you can add the file extension (-> "PATHEXT") and from now on, the file (f.e. myscript.py) is callable from everywhere trough the terminal, even without the "python" prefix and the ".py" ending.

Thanks for every answer,
(and yeah: stay healthy :))

Paulo Tomé
  • 3,782
  • you can do the same as in Windows on Unix-Systems: take a look at this question https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path – derwana Mar 17 '20 at 11:59
  • But when I do this, following error message comes, when typing the command bash: /my/path/mycommand: Permission denied – CMinusMinus Mar 17 '20 at 12:22
  • Did you run chmod +x on those files? – Panki Mar 17 '20 at 12:23
  • You need to include this line on the beginning of all files #!/usr/bin/env python and set these files executable with chmod +x filename. As described here. – BlueManCZ Mar 17 '20 at 12:25

0 Answers0