[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is a for .. do list newline sensitive ?
From: |
alex xmb sw ratchev |
Subject: |
Re: is a for .. do list newline sensitive ? |
Date: |
Sun, 15 Oct 2023 10:00:16 +0200 |
thank you ..
On Sat, Oct 14, 2023, 21:05 Lawrence Velázquez <vq@larryv.me> wrote:
> On Sat, Oct 14, 2023, at 2:32 PM, Lawrence Velázquez wrote:
> > It is not a bug; if present, the word list may not be preceded by
> > a line break.
>
> If for some reason you *really* want to keep the variable and word
> list on separate lines, you can break before "in". This is portable.
>
> % cat example.sh
> for x
> in foo bar baz
> do
> printf %s "$x"
> done
> echo
> % bash ./example.sh
> foobarbaz
> % dash ./example.sh
> foobarbaz
> % ksh ./example.sh
> foobarbaz
> % mksh ./example.sh
> foobarbaz
> % oksh ./example.sh
> foobarbaz
> % yash ./example.sh
> foobarbaz
> % zsh --emulate sh ./example.sh
> foobarbaz
>
> --
> vq
>