From owner-freebsd-questions@freebsd.org Wed May 20 12:45:58 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 568BD2D88E8 for ; Wed, 20 May 2020 12:45:58 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49RstY2jHmz49wt for ; Wed, 20 May 2020 12:45:57 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([94.222.22.33]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPA (Nemesis) id 1MQ5f4-1jOH6h1FTM-00M5pr; Wed, 20 May 2020 14:45:55 +0200 Date: Wed, 20 May 2020 14:45:55 +0200 From: Polytropon To: listac@nebelschwaden.de Cc: freebsd-questions@freebsd.org Subject: Re: Moving sources (base/ports) from /usr Message-Id: <20200520144555.2e935417.freebsd@edvax.de> In-Reply-To: References: <8d48921e-7af1-9313-0781-4ba4bd9c1f10@nebelschwaden.de> <20200520110833.f47610a48f0f28dd563c13aa@sohara.org> <2c3bd26c-aaa3-9998-e5e5-e3f4f3796ffc@nebelschwaden.de> <0b98639e-e714-412c-950e-7d20be5d1147@hedeland.org> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:uh4U4Nws6Iy5Al/kdDHBH+m1fj8x3tAJB8hoVmP0F0U5fbIMOIT Mk4SaLCvRBD6xO7OZcvS0G+XfikKYT6gwoJpnjN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b X-Rspamd-Queue-Id: 49RstY2jHmz49wt X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 212.227.17.10) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [3.06 / 15.00]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; RCVD_VIA_SMTP_AUTH(0.00)[]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; HAS_ORG_HEADER(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[94.222.22.33:received]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.35)[0.351]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.31)[0.312]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[212.227.17.10:from]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.227.17.10:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2020 12:45:58 -0000 On Wed, 20 May 2020 13:49:19 +0200, Ede Wolf wrote: > Sometimes, being pedantic helps quite a bit: > > ... (fresh login) > # echo $SOURCEDIR > /clutter/src > # env | grep SOURCEDIR > # > # SOURCEDIR="/clutter/src" > # export SOURCEDIR > # env | grep SOURCEDIR > SOURCEDIR=/clutter/src > > Even if this distinction is currently raising more question than it > answers, it at least explains the behaviour. It does. My assumption (and therefore not thinking about this possibility) was that you had set and exported (!) the variable to the environment. The common forms FOO="bar" export FOO and export FOO="bar" are the forms typically found when you want to modify tne environment, and _that_ is what's being passed from one instance of the shell to the next instance (subshell). Regular variables do not get passed that way: $ FOO=bar $ echo $FOO bar $ sh $ echo $FOO $ _ If you use "export" here, you can easily see the difference: $ FOO=bar $ echo $FOO bar $ export FOO $ sh $ echo $FOO bar $ _ The mentioned form $ export FOO=bar would lead to the same effect. Checking with "env" is a good idea if you want to explicitely (!) confirm that a certain variable is set in the environment, not just as a mere shell variable. This doesn't just apply to shell scripts invoked by shell scripts, but also to program that query *envp[], the (optional) third parameter of the standard main() function. > And I know I need to rethink my understanding of shell vs. environment > variables (and the corresponding files). The files can set shell variables and environmental variables. The case for _which_ kind of shell this applies (login shell, interactive shell, scripting shell) depends on the file name, as explained in "man sh", section "Invocation". > Thanks for the heads up, with that in mind I'll reread the comment on > sh(1) and .shrc from before and, well, have a talk with my favourite > search enginge. It's a search engine, not a listening engine. ;-) However, it is not a bad idea to visit fundamental knowledge and shell basics from time to time. It makes life easier, especially for those corner cases where you expect a certain behaviour, but it strangely does not happen. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...