bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Command grouping


From: Greg Wooledge
Subject: Re: Command grouping
Date: Mon, 14 Oct 2019 08:32:00 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Mon, Oct 14, 2019 at 12:37:34PM +0200, Mischa Baars wrote:
> 
> I believe you're missing the point. You were probably distracted by me 
> brabbling about whitespaces.

1. The questioner's first description of the problem/question will
   be misleading.

   1.1 The questioner's second description of the problem/question will
       also be misleading.

9. All examples given by the questioner will be broken, misleading,
   wrong, and/or not representative of the actual question.

> Again. When scripting, commands often do not fit on one line.

So, you split the command across multiple lines, either using the natural
line-breaking points that the grammar permits (a line ending with | or
&& or || must be continued on the next line), or by using \ .

> To overcome this problem, let's try to separate the commands from the loops:
> 
> --- emphasis on separation ---
> 
> shopt -s globstar; export E0="\${i}"; for i in ./pace/**/*.c; do ls ${E0@P}; 
> done;            # functions as supposed to
> shopt -s globstar; export E0="ls \${i}"; for i in ./pace/**/*.c; do ${E0@P}; 
> done;            # functions as supposed to

What on earth does any of this mean?

What are you trying to do?

All I see here are quoting failures, the dangerous use of ls in a script,
a command stuffed into a variable, and the nonsensical and extra-dangerous
prompt-expansion of data before using it as a command, with absolutely
no rhyme or reason or rationale.

https://mywiki.wooledge.org/Quotes
https://mywiki.wooledge.org/ParsingLs
https://mywiki.wooledge.org/BashFAQ/050

And, as above, bashphorism 9, because I'm about 80% confident that
your "example" is "just an example", and is not actual code, and
therefore no conclusions can be drawn from ANYTHING you posted, not
even what the FREAKING QUESTION IS.


> --- emphasis on pathname expansion ---
> 
> shopt -s globstar; export E0="\${i}"; for i in ./pace/**/*.c; do ls 
> "${E0@P}"; done;          # functions as supposed to
> shopt -s globstar; export E0="ls \${i}"; for i in ./pace/**/*.c; do 
> "${E0@P}"; done;          # does not function as supposed to
> 
> Aliases are not defined in makefiles, and I remember there to be something 
> uncomfortable with functions in the loop too, I would have to look that up. 
> So we'll
> have to do with variables being used to define functions.

What does ANY OF THIS MEAN!?!

What are you TRYING TO DO?

Nothing you've written tells me what your question is.  How on earth
do you expect anyone to help you if we can't even tell what you want?

Makefiles are off topic here.  Are you trying to write a Makefile?  If
so, you should SAY THAT SOMEWHERE!  (And take it to a place where it's
on topic, but maybe someone here will take pity on you and help anyway.)

Aliases do not go in scripts.  (YES, MS. WALSH, THAT INCLUDES YOU.)
Nor do they go in Makefiles.  If Makefiles are even a thing you are
doing and not just another god damned red herring.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]