Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15505

Re: Command grouping

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From "" <kfm@plushkava.net>
Newsgroups gnu.bash.bug
Subject Re: Command grouping
Date Sun, 13 Oct 2019 10:54:49 +0100
Lines 47
Approved bug-bash@gnu.org
Message-ID <mailman.475.1570960500.9715.bug-bash@gnu.org> (permalink)
References <acdb21fe37e928c2063c95ec1d013fe695e3bdf1.camel@cyberfiber.eu> <06070f12-033d-0736-1733-a035629104cd@case.edu> <735ae0ed6542416188552545d16a02936070e493.camel@cyberfiber.eu> <20191013105449.45845e406ffc7cb4e1829ea2@plushkava.net>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1570960501 9814 209.51.188.17 (13 Oct 2019 09:55:01 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=plushkava.net; h=date:from:to:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=fm3; bh= wRBaA3mYFbOmQVUBwbpkHWDXvup1q1pf+4T3uAYQP3w=; b=h9sDSCk3M19/8zn9 ttDsatAUkqdISs3W0CDWg7rwfh/EtnIfkQSctedGO5okYOErMuO2Nfqwas46qfnU fbo9nBjFHd1tusScvGeY6Qk4J/vzKJ6gqY63yk9fu2bS9CUBXmNhWu3+6u6M3OLh XMt/Eso9K0itkq7v0bp9W8W9assSyKR1MGinecjRQ5fbSnCTlh4/cPwzjRWtdsh3 sFO+QJlv3QJkWFGHnKHP6jZP8+5inhioKQcmvQIIuXn1M8h6vu3IUvN8NuPK+hcf gJC9RUXCvv246CKrUlUHnZN1USeuMC1NWOjXSb2qxmInZF+3KVjm9u9lGwNjMipu PayPDw==
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=wRBaA3mYFbOmQVUBwbpkHWDXvup1q1pf+4T3uAYQP 3w=; b=akCv3fHuhzpc9M6XDjC+YTgbjmZkCpDDv5zr8+aSWwP6+xcAFQLPaRKxU bA0wrHg1n+0keP7WSiZE6vbieXQNTd85UHfYu7uMPChccz+SO/miIwuESs79V6fO 1DJoZJucDoTZaCJvQl1Wt1ACMDstMVx2vVVFVgUaNE4UV45H8jfsTpf3deelOj6/ KjwBJYXGkG0lN5YGCkBe9MudKU6usGZfkjzXkZqMNQNHvzC+keZbFuYFwU1srnJR LIRlVl3MOGIEe8dMdBq5TdkGoZUIhYStGIFkZPxGvvLJnvmKcoRjB10Uw18r002K DXDnq6W9Vp9ezhV8nWRdTgVeESn6g==
X-ME-Sender <xms:a_SiXRydCYz1yMDf4DaXyU0TFb4ulsBPeqWKBhnOIjai75VZn6_a5Q>
X-ME-Proxy-Cause gggruggvucftvghtrhhoucdtuddrgedufedrieelgddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecuogfgmhhpthihtehlihgrshculddvtddmnecujfgurh epfffhvffukfgjfhfogggtgfesthejredtjfdtvdenucfhrhhomhepfddfuceokhhfmhes phhluhhshhhkrghvrgdrnhgvtheqnecuffhomhgrihhnpeifohholhgvughgvgdrohhrgh enucfkphepudelfedrudefkedrvddukedrudeltdenucfrrghrrghmpehmrghilhhfrhho mhepkhhfmhesphhluhhshhhkrghvrgdrnhgvthenucevlhhushhtvghrufhiiigvpedt
X-ME-Proxy <xmx:a_SiXRuAuZQg0r_a3uoG9eaBZS4FFemDPWWAS3QAf53ZbG_D-FHdxA> <xmx:a_SiXbE9299KC_umRxyLbL6RIZYy2kKrdthmzUvuA421n8BXLttD8g> <xmx:a_SiXf4ZhP1F97MeAR4f4K-noEY5UIKPM8VbrX4bfyQRBngJMo5xxQ> <xmx:bPSiXbapwgohnEZnk93U3Wsr8f26TRjwDD6Hz7c2bLQMJO82qZX2Gg>
In-Reply-To <735ae0ed6542416188552545d16a02936070e493.camel@cyberfiber.eu>
X-Mailer Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 64.147.123.24
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <20191013105449.45845e406ffc7cb4e1829ea2@plushkava.net>
X-Mailman-Original-References <acdb21fe37e928c2063c95ec1d013fe695e3bdf1.camel@cyberfiber.eu> <06070f12-033d-0736-1733-a035629104cd@case.edu> <735ae0ed6542416188552545d16a02936070e493.camel@cyberfiber.eu>
Xref csiph.com gnu.bash.bug:15505

Show key headers only | View raw


On Sun, 13 Oct 2019 10:09:26 +0200
Mischa Baars <mjbaars1977.bug-bash@cyberfiber.eu> wrote:

> On Sat, 2019-10-12 at 10:42 -0400, Chet Ramey wrote:
> > On 10/12/19 9:02 AM, Mischa Baars wrote:
> > > Hi,
> > > 
> > > Perhaps to better have a look at this mail, than the previous mail.
> > > 
> > > In trying to group commands, in this case compiler commands, I found some peculiarities while trying different combinations of the 'Internal Field
> > > Separator'
> > > and the 'Parameter Expansion' operator ${parameter@P}.
> > 
> > I haven't looked at this in any depth, but you should realize that running
> > 
> > declare IFS=$(printf ' \t\n')
> > 
> > will result in IFS being set to space and tab, since command substitution
> > removes the trailing newline. Maybe that will make a difference.
> > 
> 
> Hi Chet,
> 
> The bash manual page tells us that is the default value, nothing special.
> 
> I was trying to remove the whitespace, such that whitespaces are allowed in project directory names, as was considered the default scenario as far as I know.

You are not removing the whitespace values from IFS. Instead, you are re-asserting the default value of IFS, only with \n missing (for the reason that Chet describes). Given that the output of your find command is newline-delimited, doing so will not end well. Writing IFS=$'\n' may function as you expected. However, this is an intrinsically broken approach to begin with. See https://mywiki.wooledge.org/DontReadLinesWithFor.

Instead, consider any of the following options:-

  * find -exec or -execdir
  * a for loop that iterates over a glob
  * a while/read loop that consumes find's output (using -print0, ideally)

Your problems are compounded by failing to quote the expansion of i in the course of invoking gcc (lines 4-5), and by the flawed attempt at a workaround (lines 2 and 6-7). See https://mywiki.wooledge.org/BashFAQ/050. Not only that, but the *.c argument conveyed to find should be quoted, so as to inhibit pathname expansion.

Here is an example of how one might use for:-

shopt -s globstar
for i in ./pace/**/*.c; do
  gcc -o "${i%.c}" "$i"
done

-- 
Kerin Millar

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Command grouping "" <kfm@plushkava.net> - 2019-10-13 10:54 +0100

csiph-web