Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jan 2013 01:09:54 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Fbsd8 <fbsd8@a1poweruser.com>
Cc:        FreeBSD questions <questions@freebsd.org>
Subject:   Re: sh & export
Message-ID:  <20130129010954.897294b3.freebsd@edvax.de>
In-Reply-To: <51070FD6.8070808@a1poweruser.com>
References:  <51070FD6.8070808@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 28 Jan 2013 18:55:02 -0500, Fbsd8 wrote:
> I'm reading a script and i see a lot of exports.
> 
> Is there some command to display the exported environment?

Yes, sh's builtin "env" does this.



> The env command does not show them. Only see things made by setenv command.

It seems you're mixing shells here. The C Shell uses setenv
to set variables, printenv to list them. The systems's sh
uses export to set variables, and env to print them.

Example (with exported and non-exported variable:

	$ export ASDF=yxcvbnm
	$ env | grep ASDF
	ASDF=yxcvbnm

	$ JKL=qwertzuiop
	$ env | grep JKL
	$ echo $JKL
	qwertzuiop

And compare for the C shell:

	% setenv ASDF yxcvbnm
	% printenv | grep ASDF
	ASDF=yxcvbnm

	% set JKL=qwertzuiop
	% printenv | grep JKL
	% echo $JKL
	qwertzuiop

If you omit the "| grep" step, the full list will be printed.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130129010954.897294b3.freebsd>