From owner-freebsd-questions@FreeBSD.ORG Tue Jan 29 01:17:16 2013 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0F5FB6E1 for ; Tue, 29 Jan 2013 01:17:16 +0000 (UTC) (envelope-from fbsd8@a1poweruser.com) Received: from mail-03.name-services.com (mail-03.name-services.com [69.64.155.195]) by mx1.freebsd.org (Postfix) with ESMTP id D5957C19 for ; Tue, 29 Jan 2013 01:17:15 +0000 (UTC) Received: from [10.0.10.3] ([173.88.197.103]) by mail-03.name-services.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 28 Jan 2013 17:17:16 -0800 Message-ID: <51072319.7020102@a1poweruser.com> Date: Mon, 28 Jan 2013 20:17:13 -0500 From: Fbsd8 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: kpneal@pobox.com Subject: Re: sh & export References: <51070FD6.8070808@a1poweruser.com> <444ni0dewi.fsf@lowell-desk.lan> <51071ABF.1020603@a1poweruser.com> <20130129011118.GA71113@neutralgood.org> In-Reply-To: <20130129011118.GA71113@neutralgood.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Jan 2013 01:17:16.0898 (UTC) FILETIME=[608B7C20:01CDFDBE] X-Sender: fbsd8@a1poweruser.com X-Authenticated-Sender: fbsd8@a1poweruser.com X-EchoSenderHash: [fbsd8]-[a1poweruser*com] Cc: FreeBSD questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2013 01:17:16 -0000 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.