Date: Mon, 28 Jan 2013 20:17:13 -0500 From: Fbsd8 <fbsd8@a1poweruser.com> To: kpneal@pobox.com Cc: FreeBSD questions <questions@freebsd.org> Subject: Re: sh & export Message-ID: <51072319.7020102@a1poweruser.com> In-Reply-To: <20130129011118.GA71113@neutralgood.org> References: <51070FD6.8070808@a1poweruser.com> <444ni0dewi.fsf@lowell-desk.lan> <51071ABF.1020603@a1poweruser.com> <20130129011118.GA71113@neutralgood.org>
next in thread | previous in thread | raw e-mail | index | archive | help
kpneal@pobox.com wrote: > On Mon, Jan 28, 2013 at 07:41:35PM -0500, Fbsd8 wrote: >> This is what I am looking at in a sh script >> >> echo export jail_${jailname}_hostname=\"${jailname}\" >> puts it into the env >> and this brings it back out >> eval jailname=\"\$jail_${jailname}_hostname\" >> >> Question is how can I display from the console command >> line what has been exported? >> >> env issued on the console command line does not show >> any thing named jail. > > Environment variables are only exported to children of the shell that > created or inherited them. When you run a script you normally have your > command line shell start a child shell which then executes the script. > When the child shell that runs the script finishes the script it ends and > control returns to the parent. The child's environment at this point is > gone, but the parent couldn't have looked at it anyway. Parents don't > really know what their children are doing. > > So, to answer your question above, "You can't display from the console > what was set in a script." OK then from within a script what single command would show everything? I tested with a script with only the env command and did not get any thing more than issuing env from the console command line.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51072319.7020102>