[Top][All Lists]

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

Re: make install failed; dump core in mkdir

From: Eli Schwartz
Subject: Re: make install failed; dump core in mkdir
Date: Mon, 2 Dec 2019 10:06:36 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

On 12/2/19 9:56 AM, Greg Wooledge wrote:
> On Mon, Dec 02, 2019 at 09:51:12PM +0700, pepa65 wrote:
>> On 12/2/19 9:38 PM, Andreas Kusalananda Kähäri wrote:>      for dirpath do
>>>          command mkdir -p "$dirpath" || return
>>>      done
>> It is very sad that the 'do' is not optional (non-backwards compatibility
>> breaking feature request!), and it has to be the start of the next
>> commandline (after ';' or the start of a new line), so:
>>     for dirpath
>>     do command mkdir -p "$dirpath" || return
>>     done
> You're mistaken.
> wooledg:~$ set -- a b c
> wooledg:~$ for i do echo "$i"; done
> a
> b
> c

Interesting, I didn't expect that to work. It doesn't work if you use
'in', which I normally do.

$ for i in "$@" do echo "$i"; done
bash: syntax error near unexpected token `done'

I guess that makes sense -- the 'in' will try to treat the words "do"
"echo" "$i" as iteration elements, but without 'in', there can only be
one argument to 'for', so bash can safely parse 'do' without the ;

But I think I'll still use them despite being not strictly needed, or
I'll just confuse myself once I do need them. :p I've used them for too
long by now, anyway.

Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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