TERMINAL_STUFF Telegram 2812
Forwarded from La3tKnight
The Unix env Lookup Trick

On some Unix systems, you can avoid writing the path to the Python interpreter in your script file by writing a special comment on the first line, like this:

#!/usr/bin/env python
...script goes here...

This tells the env program to find the Python interpreter based on your system's search path settings. This can make your scripts more portable, because you don't need to hard code the path to Python in the first line of all your scripts. This means that if you move your scripts to a new machine, or if Python is moved to a new location, you only need to update the PATH environment variable, not all of your scripts.

As long as env is available on all systems where you want to run your scripts, they will work no matter where Python is installed on your system. In fact, this form of env is generally recommended over even something as generic as /usr/bin/python, because some platforms may install Python in other locations. However, it is important to note that this assumes that env is installed in the same location on all systems. On some machines, it may be installed in /sbin, /bin, or another directory. If this is not the case, then your scripts will not be portable.

Learning Python: Powerful Object-Oriented Programming
Book by Mark Lutz

🗞 La3tKnight



tgoop.com/terminal_stuff/2812
Create:
Last Update:

The Unix env Lookup Trick

On some Unix systems, you can avoid writing the path to the Python interpreter in your script file by writing a special comment on the first line, like this:

#!/usr/bin/env python
...script goes here...

This tells the env program to find the Python interpreter based on your system's search path settings. This can make your scripts more portable, because you don't need to hard code the path to Python in the first line of all your scripts. This means that if you move your scripts to a new machine, or if Python is moved to a new location, you only need to update the PATH environment variable, not all of your scripts.

As long as env is available on all systems where you want to run your scripts, they will work no matter where Python is installed on your system. In fact, this form of env is generally recommended over even something as generic as /usr/bin/python, because some platforms may install Python in other locations. However, it is important to note that this assumes that env is installed in the same location on all systems. On some machines, it may be installed in /sbin, /bin, or another directory. If this is not the case, then your scripts will not be portable.

Learning Python: Powerful Object-Oriented Programming
Book by Mark Lutz

🗞 La3tKnight

BY نوشته‌های ترمینالی


Share with your friend now:
tgoop.com/terminal_stuff/2812

View MORE
Open in Telegram


Telegram News

Date: |

Activate up to 20 bots Those being doxxed include outgoing Chief Executive Carrie Lam Cheng Yuet-ngor, Chung and police assistant commissioner Joe Chan Tung, who heads police's cyber security and technology crime bureau. During a meeting with the president of the Supreme Electoral Court (TSE) on June 6, Telegram's Vice President Ilya Perekopsky announced the initiatives. According to the executive, Brazil is the first country in the world where Telegram is introducing the features, which could be expanded to other countries facing threats to democracy through the dissemination of false content. 1What is Telegram Channels? Over 33,000 people sent out over 1,000 doxxing messages in the group. Although the administrators tried to delete all of the messages, the posting speed was far too much for them to keep up.
from us


Telegram نوشته‌های ترمینالی
FROM American