bug-bash
[Top][All Lists]
Advanced

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

Re: declare a="$b" if $a previously set as array


From: konsolebox
Subject: Re: declare a="$b" if $a previously set as array
Date: Wed, 10 Dec 2014 21:27:53 +0800

On Wed, Dec 10, 2014 at 6:43 PM, Stephane Chazelas
<stephane.chazelas@gmail.com> wrote:
> 2014-12-10 06:33:00 +0800, konsolebox:
> [...]
>> > Not sure what you mean by that last sentence, but all of dash,
>> > yash, mksh, pdksh, AT&T ksh, posh, zsh (so virtually all modern
>> > Bourne-like shells) do support local scopes each with variations
>> > of behaviour and syntax.
>>
>> I know ksh, pdksh and zsh supports local but I didn't know that dash
>> does it too - or maybe I forgot.  I always remember that it's a pure
>> POSIX shell but apparently it's not.
>
> dash (and posh) follow (or at least used to) another standard,
> the Debian policy which is more or less POSIX with a few
> additions (from XSI, UP and its owns).
>
> ...

Thank you for the information.

>> And sorry I actually meant
>> "some other".  Consider a more conservative shell like heirloom-sh.
> [...]
>
> Note that that's the Bourne shell, not a POSIX sh.

I was actually wanting to say that heirloom-sh is still a modernized
shell (in code) despite being a strict clone of the original sh.  I
believe many people still base their scripts from it so I also see that
as a shell to consider despite not being POSIX.

> It's ironic that local scoping is now implemented in virtually
> all POSIX shells but not specified by POSIX.

And that is where I made the assumption about other shells.  I
don't really study POSIX and I don't really care about it because I
don't see it as the general standard to base from when creating
compatible scripts.  Moreover I still respect bourne shell.

See https://sourceforge.net/p/loader/code/ci/base/tree/loader.sh

Cheers,
konsolebox



reply via email to

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