DEV Community

taijidude
taijidude

Posted on

2 1

Run python scripts with less typing...

When you run a lot of python scripts from the linux command line there is a nice way to save some key strokes.

You have to put the following in the first line of your script. This is a called a shebang line. Although i have no idea why it has that name.

#!/usr/bin/env python
Enter fullscreen mode Exit fullscreen mode

After this you have to make the script executable.

chmod +x generate.py
Enter fullscreen mode Exit fullscreen mode

If all this is done, you can just run the script like a regular shell script.

before:

python test.py
Enter fullscreen mode Exit fullscreen mode

after:

./test.py
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay