Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
PRINTENV(1)		  BSD General Commands Manual		   PRINTENV(1)

     printenv, env -- print out	the environment, set and print environment

     printenv [name]
     env [-] [-i] [name=value ...] [command]

     Printenv prints out the names and values of the variables in the environ-
     ment, with	one name/value pair per	line.  If name is specified, only its
     value is printed.

     If	a name is specified and	it is not defined in the environment, printenv
     returns exit status 1, else it returns status 0.

     Some shells may provide a builtin printenv	command	which is similar or
     identical to this utility.	 Consult the builtin(1)	manual page.

     Env executes command after	modifying the environment as specified on the
     command line.  The	option name=value specifies an environment variable,
     name, with	a value	of value.

     The options are as	follows:

     -i	     Execute the command with only those environment values specified.
	     The environment inherited by env is ignored completely.

     -	     Identical to the -i option, available for backward	compatibility.

     If	no command is specified, env prints out	the names and values of	the
     variables in the environment, with	one name/value pair per	line.

     env is sometimes useful with the "#!" construct (see execve(2)).  The
     only difference between "#!/usr/local/bin/foo" and
     "#!/usr/bin/env /usr/local/bin/foo" is that the latter works even if
     /usr/local/bin/foo	is itself interpreted.	Using env this way also	allows
     one to reference foo without the path, as well as set up the environment
     as	desired.

     csh(1), sh(1), execvp(3), environ(7)

     The printenv command appeared in 3.0BSD.

     Env doesn't handle	commands with equal (``='') signs in their names, for
     obvious reasons.

BSD				 June 6, 1993				   BSD


Want to link to this manual page? Use this URL:

home | help