[Tutor] shebang problem

Brian van den Broek broek at cc.umanitoba.ca
Sun Nov 5 09:50:36 CET 2006


Alan Gauld said unto the world upon 11/04/2006 06:47 PM:
> brian at gottlob:~/test$ ls -la shebangtest.py
> -rwxr-xr-- 1 brian brian 68 2006-11-04 02:29 shebangtest.py
> 
> so the file is called shebangtest.py...
> 
>> brian at gottlob:~/test$ shebangtest
>> bash: shebangtest: command not found
> 
> but you try to run shebangtest...
> 
> bash can't find the file. you didn't put the .py on the end


Well, shebangtest.py also didn't work as evidenced by one of the lines 
you snipped.

> Also you may not have . in your path. For security reasons it isn't 
> there by default.
> 
> Try
> 
> brian at gottlob:~/test$ ./shebangtest.py

And that would be it.

It didn't occur to me to try ./shebangtest.py in lieu of the bare 
shebangtest.py. My command-line instinct were installed back in the 
days of using DOS on an XT. DOS (at least the version I used) first 
checked the cwd and only then searched the path. The security 
implications that Alan and Rick pointed to make the POSIX/bash 
behaviour make perfect sense on reflection, though.

Thanks to all who replied, both on and off list,

Brian vdB



More information about the Tutor mailing list