From: Leonid Krivoshein <klark.devel@gmail.com>
To: devel-newbies@lists.altlinux.org
Subject: Re: [newbies] Bash and POSIX - local variables
Date: Sat, 22 Nov 2025 02:25:40 +0300
Message-ID: <4ba14a17-120e-40a3-a89c-c819b72fee70@gmail.com> (raw)
In-Reply-To: <1eb9ca4e-03e9-4059-a13c-21426fc5ec54@yandex.ru>
On 11/21/25 12:32, Alexander Lubyagin wrote:
> 21.11.2025 00:44, Leonid Krivoshein пишет:
>>> [ ... ]
>>>
>>> Полагаться ли на поддержку локальных переменных?
>>
>> Зависит от целеполагания. Поддержка local появилась давно. Во многих
>> системах /bin/sh является симлинком на что-то, что совершенно не
>> обязано быть POSIX-compliant shell. Например, даже в старых альтах
>> это был bash3 с поддержкой local. Проверяйте ash, используйте
>> subshell ( ... ), если так важна переносимость. По-моему, все, кто за
>> неё радел, уже давно забили на это дело и пользуются всеми прелестями
>> башизмов. :-) Куда важнее для правильного скриптования использовать
>> shellcheck.
>
> Да, по-моему, переносимость между shell-ами в соответствии со
> стандартом является реликтом.
>
> Будет ли нормальным заменить shebang-строки в модулях Альтератора на
> /bin/bash ?
>
Нет, потому что нет оснований для такой замены. В те времена, когда
писалось большинство его модулей, это было фактически bash3. Под
сложившиеся стили проектов необходимо подстраиваться.
> Там полно локальных переменных.
>
Конечно, они давно поддерживаются практически везде.
> Хотя в ash и pdksh локальные переменные и поддерживаются.
>
> $ ls -l /bin/sh
> lrwxrwxrwx 1 root root 3 фев 19 2019 /bin/sh-> sh4
>
Это вообще ни о чём не говорит. У данного симлинка в репо много провайдсов.
https://packages.altlinux.org/ru/sisyphus/files/?q=%2Fbin%2Fsh
--
WBR, Leonid Krivoshein.
prev parent reply other threads:[~2025-11-21 23:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 21:44 ` Leonid Krivoshein
2025-11-21 9:32 ` Alexander Lubyagin
2025-11-21 23:25 ` Leonid Krivoshein [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ba14a17-120e-40a3-a89c-c819b72fee70@gmail.com \
--to=klark.devel@gmail.com \
--cc=devel-newbies@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
devel@ where you _can_ ask
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel-newbies/0 devel-newbies/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel-newbies devel-newbies/ http://lore.altlinux.org/devel-newbies \
devel-newbies@lists.altlinux.org devel-newbies@lists.altlinux.ru devel-newbies@lists.altlinux.com
public-inbox-index devel-newbies
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel-newbies
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git