BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 4 definitions for Env.

Env (shell)

Print-Friendly
About 2 pages (512 words)

Bookmark and Share Know this topic well? Help others and get FREE products!

env is a shell utility for Unix-like operating systems (including Linux). It is used to either print a list of environment variables or run another utility in an altered environment without having to modify the currently existing environment. Using env, variables may be added or removed, and the values of existing variables may be changed. In practice, env has another common use. It is often used by scripts to launch the correct interpreter. In this usage, the environment is typically not changed.

Examples

To clear the environment for a new shell:

env - /bin/sh

To launch the X Window application xcalc and have it appear on a different display:

env DISPLAY=foo.bar:1.0 xcalc

Here is the code of a very simple Python script:

 #!/usr/bin/env python
 print "Hello World."

In this example, /usr/bin/env is the full path of the env command. The environment is not altered. Note that it is possible to specify the interpreter without using env, by giving the full path of the python interpreter. A problem with that approach is that on different computer systems, the exact path may be different. By instead using env as in the example, the interpreter is searched for and located at the time the script is run. This makes the script more portable, but also increases the risk that the wrong interpreter is selected because it searches for a match in every directory on the executable search path.

External links

View More Summaries on Env (shell)
 
Ask any question on Env (shell) and get it answered FAST!
Answer questions in BookRags Q&A and earn points toward
discounted or even FREE Study Guides and other BookRags products!
Learn more about BookRags Q&A
Copyrights
Env (shell) from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

Article Navigation
Join BookRagslearn moreJoin BookRags




About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy