source: trunk/minix/man/man1/env.1@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.8 KB
Line 
1.TH ENV 1
2.SH NAME
3env \- set environment for command
4.SH SYNOPSIS
5.B env
6.RB [ \-ia ]
7.RI [ name\fB=\fIvalue "] ..."
8.RI [ utility
9.RI [ argument "...]]"
10.SH DESCRIPTION
11.B Env
12modifies its environment according to the
13.IB name = value
14arguments, and executes
15.I utility
16with the given arguments and the modified environment.
17.PP
18If no utility is specified then the modified environment is printed as
19.IB name = value
20strings, one per line.
21.SH OPTIONS
22.TP
23.B \-i
24Use exactly the environment specified by the arguments; the inherited
25environment is ignored.
26.TP
27.B \-a
28Specify all arguments for the utility, i.e. the first of the arguments is
29used as
30.BR "argv[0]" ,
31the program name. Normally the program name is
32.I utility
33itself.
34.SH ENVIRONMENT
35.TP 8n
36.B PATH
37The path used to find utility. It is as modified by
38.BR env ,
39i.e.
40.B not
41the inherited
42.BR PATH .
43.SH "SEE ALSO"
44.BR sh (1),
45.BR execvp (3),
46.BR environ (5).
47.SH DIAGNOSTICS
48The return code is
49.B 0
50after successfully printing the environment,
51.B 1
52on an error within
53.BR env ,
54.B 126
55if the
56.I utility
57could not be executed, or
58.B 127
59if
60.I utility
61could not be found. Appropriate diagnostic messages are printed on standard
62error.
63If
64.I utility
65can be executed then it replaces
66.BR env ,
67so the return code is then the return code of
68.IR utility .
69.SH NOTES
70When run from the standard shell
71.B env
72is only useful with options or without arguments. Otherwise the shell can
73do exactly what
74.B env
75can do, simply omit the word "env" on the command line.
76.PP
77One interesting use of
78.B env
79is with #! on the first line of a script to forge a PATH search for an
80interpreter. For example:
81.PP
82.RS
83#!/usr/bin/env perl
84.RE
85.PP
86This will find the Perl interpreter if it is within the user's PATH. Most
87UNIX-like systems have
88.B env
89in /usr/bin, but
90.B perl
91may be anywhere.
92.SH AUTHOR
93Kees J. Bot <kjb@cs.vu.nl>
Note: See TracBrowser for help on using the repository browser.