Kali Linux rennen das Python -Skript überall
# Make a python script:
cd /home/el/bin
touch stuff.py
chmod +x stuff.py
# Find out where your python is:
which python
/usr/bin/python
# Put this code in there:
#!/usr/bin/python
print "hi"
# Run in it the same directory:
python stuff.py
# Go up a directory and it's not available:
cd ..
stuff.py
-bash: stuff.py: command not found
# Not found! It's as we expect, add the file path of the python file to
# the $PATH
vi ~/.bashrc
# Add the file:
export PATH=$PATH:/home/el/bin
# Save it out, re apply the .bashrc, and retry
source ~/.bashrc
# Try again:
cd /home/el
stuff.py
# Prints:
hi
# The trick is that the bash shell knows the language of the file via
# the shebang.
miletoo