Nothing happens when executing python shebang script in / usr / local / bin /

Nothing happens when executing python shebang script in / usr / local / bin /

Hope someone can help me. So I made a simple python program called test to test the shebang scripts (I used chmod to make it executable):

#!/usr/bin/python
print "hello"

      

after i copied it to / usr / local / bin / i tried to invoke it by typing my shell: test

but nothing happened ... (there were no errors)

Adrian

+3


source to share


2 answers


test

is actually a shell:

$ type test
test is a shell builtin

      



Rename the script to something else, or run it directly by executing /usr/local/bin/test

.

+4


source


Blender is right: "test" is a bad name for your file. There is already a built-in wrapper called "test". It would be the same if you tried to do a python script called 'ls'. The reason it works when running './test' is because './' tells the shell to make the current directory the first in the executable path. If you rename your python script to 'bangtest' and make sure it has executable permissions (chmod + x bangtest) it will work as you wish.



+1


source







All Articles