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


Groups > gnu.bash.bug > #15688

Re: make install failed; dump core in mkdir

From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: make install failed; dump core in mkdir
Date 2019-12-02 10:06 -0500
Message-ID <mailman.127.1575299210.1979.bug-bash@gnu.org> (permalink)
References (2 earlier) <20191202135127.GS851@eeg.ccf.org> <20191202143843.GA43338@pooh.my.domain> <0ee0fed4-4542-85c7-7889-2f73b5fd31ce@passchier.net> <20191202145639.GV851@eeg.ccf.org> <cb711f35-9786-1fbf-5829-edb60bebf007@archlinux.org>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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 ;
separator.

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

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


Thread

Re: make install failed; dump core in mkdir Eli Schwartz <eschwartz@archlinux.org> - 2019-12-02 10:06 -0500

csiph-web