Suppose I want to edit /etc/profile
I want this:
PYTHONPATH = /home/CURRENT_USER/
How do I have a "variable" that will automatically fill in the current user? What about hostname? Aren't these environment variables?
|
Suppose I want to edit /etc/profile I want this: PYTHONPATH = /home/CURRENT_USER/ How do I have a "variable" that will automatically fill in the current user? What about hostname? Aren't these environment variables?
| |||
|
feedback
|
|
Also, the user's home directory is not necessarily in | |||||||||
feedback
|
|
If you wish to see all of your environmental variables available, use the following command:
Remember case sensitivity, for hostname you'll need $HOSTNAME, and $USER
| ||||
|
feedback
|
|
Another approach is to add a call to However since Python 2.6 you probably don't need to do either, because See PEP370 for details. | |||
|
feedback
|
|
In python, call os.uname() to get the hostname (and other details in an array). | |||
|
feedback
|