19b50d902SRodney W. Grimes.\" Copyright (c) 1980, 1990, 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 59b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc. 69b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 79b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 89b50d902SRodney W. Grimes.\" are met: 99b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 109b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 119b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 129b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 139b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 149b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 159b50d902SRodney W. Grimes.\" must display the following acknowledgement: 169b50d902SRodney W. Grimes.\" This product includes software developed by the University of 179b50d902SRodney W. Grimes.\" California, Berkeley and its contributors. 189b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 199b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 209b50d902SRodney W. Grimes.\" without specific prior written permission. 219b50d902SRodney W. Grimes.\" 229b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 239b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 249b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 259b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 269b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 279b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 289b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 299b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 309b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 319b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 329b50d902SRodney W. Grimes.\" SUCH DAMAGE. 339b50d902SRodney W. Grimes.\" 349b50d902SRodney W. Grimes.\" @(#)printenv.1 8.1 (Berkeley) 6/6/93 35c3aac50fSPeter Wemm.\" $FreeBSD$ 369b50d902SRodney W. Grimes.\" 379b50d902SRodney W. Grimes.Dd June 6, 1993 389b50d902SRodney W. Grimes.Dt PRINTENV 1 398fa6964aSRuslan Ermilov.Os 409b50d902SRodney W. Grimes.Sh NAME 419b50d902SRodney W. Grimes.Nm printenv , env 429b50d902SRodney W. Grimes.Nd print out the environment, set and print environment 439b50d902SRodney W. Grimes.Sh SYNOPSIS 448fe908efSRuslan Ermilov.Nm 459b50d902SRodney W. Grimes.Op Ar name 469b50d902SRodney W. Grimes.Nm env 479b50d902SRodney W. Grimes.Op Fl 4885ab7ba1SSheldon Hearn.Op Fl i 498fa6964aSRuslan Ermilov.Op Ar name Ns = Ns Ar value ... 509b50d902SRodney W. Grimes.Op Ar command 519b50d902SRodney W. Grimes.Sh DESCRIPTION 529b50d902SRodney W. Grimes.Nm Printenv 539b50d902SRodney W. Grimesprints out the names and values of the variables in the environment, 548fa6964aSRuslan Ermilovwith one name/value pair per line. 558fa6964aSRuslan ErmilovIf 569b50d902SRodney W. Grimes.Ar name 579b50d902SRodney W. Grimesis specified, only 589b50d902SRodney W. Grimesits value is printed. 599b50d902SRodney W. Grimes.Pp 609b50d902SRodney W. GrimesIf a 619b50d902SRodney W. Grimes.Ar name 629b50d902SRodney W. Grimesis specified and it is not defined in the environment, 638fe908efSRuslan Ermilov.Nm 649b50d902SRodney W. Grimesreturns exit status 1, else it returns status 0. 659b50d902SRodney W. Grimes.Pp 66befd5c23SSheldon HearnSome shells may provide a builtin 67befd5c23SSheldon Hearn.Nm 68befd5c23SSheldon Hearncommand which is similar or identical to this utility. 69befd5c23SSheldon HearnConsult the 70befd5c23SSheldon Hearn.Xr builtin 1 71befd5c23SSheldon Hearnmanual page. 72befd5c23SSheldon Hearn.Pp 739b50d902SRodney W. Grimes.Nm Env 749b50d902SRodney W. Grimesexecutes 759b50d902SRodney W. Grimes.Ar command 769b50d902SRodney W. Grimesafter modifying the environment as 778fa6964aSRuslan Ermilovspecified on the command line. 788fa6964aSRuslan ErmilovThe option 798fa6964aSRuslan Ermilov.Ar name Ns = Ns Ar value 809b50d902SRodney W. Grimesspecifies 8143b70d78SPhilippe Charnieran environment variable, 829b50d902SRodney W. Grimes.Ar name , 839b50d902SRodney W. Grimeswith a value of 849b50d902SRodney W. Grimes.Ar value . 8585ab7ba1SSheldon Hearn.Pp 8685ab7ba1SSheldon HearnThe options are as follows: 8785ab7ba1SSheldon Hearn.Bl -tag -width indent 8885ab7ba1SSheldon Hearn.It Fl i 8985ab7ba1SSheldon HearnExecute the 9085ab7ba1SSheldon Hearn.Ar command 9187faa07bSSheldon Hearnwith only those environment values specified. 9287faa07bSSheldon HearnThe environment inherited 9385ab7ba1SSheldon Hearnby 949b50d902SRodney W. Grimes.Nm env 9585ab7ba1SSheldon Hearnis ignored completely. 9685ab7ba1SSheldon Hearn.It Fl 9785ab7ba1SSheldon HearnIdentical to the 9885ab7ba1SSheldon Hearn.Fl i 9985ab7ba1SSheldon Hearnoption, available for backward compatibility. 10085ab7ba1SSheldon Hearn.El 1019b50d902SRodney W. Grimes.Pp 1029b50d902SRodney W. GrimesIf no command is specified, 1039b50d902SRodney W. Grimes.Nm env 1049b50d902SRodney W. Grimesprints out the names and values 1059b50d902SRodney W. Grimesof the variables in the environment, with one name/value pair per line. 106c1a7db88SDima Dorfman.Pp 107c1a7db88SDima Dorfman.Nm env 108c1a7db88SDima Dorfmanis sometimes useful with the 1098fa6964aSRuslan Ermilov.Dq Li #! 110c1a7db88SDima Dorfmanconstruct (see 111c1a7db88SDima Dorfman.Xr execve 2 ) . 112c1a7db88SDima DorfmanThe only difference between 1138fa6964aSRuslan Ermilov.Dq Li #!/usr/local/bin/foo 114c1a7db88SDima Dorfmanand 1158fa6964aSRuslan Ermilov.Dq Li "#!/usr/bin/env\ /usr/local/bin/foo" 116c1a7db88SDima Dorfmanis that the latter works even if 117c1a7db88SDima Dorfman.Pa /usr/local/bin/foo 118c1a7db88SDima Dorfmanis itself interpreted. 119c1a7db88SDima DorfmanUsing 120c1a7db88SDima Dorfman.Nm env 121c1a7db88SDima Dorfmanthis way also allows one to reference 122c1a7db88SDima Dorfman.Pa foo 123c1a7db88SDima Dorfmanwithout the path, 124c1a7db88SDima Dorfmanas well as set up the environment as desired. 1259b50d902SRodney W. Grimes.Sh SEE ALSO 1269b50d902SRodney W. Grimes.Xr csh 1 , 1279b50d902SRodney W. Grimes.Xr sh 1 , 1289b50d902SRodney W. Grimes.Xr execvp 3 , 1299b50d902SRodney W. Grimes.Xr environ 7 1309b50d902SRodney W. Grimes.Sh HISTORY 1319b50d902SRodney W. GrimesThe 1328fe908efSRuslan Ermilov.Nm 1339b50d902SRodney W. Grimescommand appeared in 1349b50d902SRodney W. Grimes.Bx 3.0 . 1359b50d902SRodney W. Grimes.Sh BUGS 1369b50d902SRodney W. Grimes.Nm Env 1379b50d902SRodney W. Grimesdoesn't handle commands with equal (``='') signs in their 1389b50d902SRodney W. Grimesnames, for obvious reasons. 139