purpose of shebang line
Lets say I write a python script, test.py,
#!/usr/bin/env python
print('text')
And I run it in my terminal by typing,
python test.py
The test file works with or without the shebang line.
From what I understand, the purpose of the shebang line is to tell the shell which interpreter to use (if running unix/linux).
So if I type into my terminal,
test.py
Then the file should work, right? On my Linux box, this doesn't work. In fact, the #!/usr/ gets replaced by +q6b75.
Is my understanding correct? Am I running the script correctly? What is the purpose of the shebang line? When does one need it?
Posted Feb 22, 2016, 5:47 AM UTC · edited
15