Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.shell > #26900 > unrolled thread
| Started by | Frank Winkler <usenet@f.winkler-ka.de> |
|---|---|
| First post | 2026-06-12 09:30 +0200 |
| Last post | 2026-06-24 11:41 +0000 |
| Articles | 2 on this page of 22 — 9 participants |
Back to article view | Back to comp.unix.shell
Variable var names Frank Winkler <usenet@f.winkler-ka.de> - 2026-06-12 09:30 +0200
Re: Variable var names gazelle@shell.xmission.com (Kenny McCormack) - 2026-06-12 09:02 +0000
Re: Variable var names Frank Winkler <usenet@f.winkler-ka.de> - 2026-06-13 12:29 +0200
Re: Variable var names gazelle@shell.xmission.com (Kenny McCormack) - 2026-06-13 11:14 +0000
Re: Variable var names Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-06-13 13:15 +0200
Re: Variable var names ram@zedat.fu-berlin.de (Stefan Ram) - 2026-06-12 11:26 +0000
Re: Variable var names ram@zedat.fu-berlin.de (Stefan Ram) - 2026-06-12 11:38 +0000
Re: Variable var names Frank Winkler <usenet@f.winkler-ka.de> - 2026-06-12 14:07 +0200
Re: Variable var names ram@zedat.fu-berlin.de (Stefan Ram) - 2026-06-12 12:31 +0000
Re: Variable var names Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-13 02:48 +0000
Re: Variable var names Christian Weisgerber <naddy@mips.inka.de> - 2026-06-12 12:12 +0000
Re: Variable var names Frank Winkler <usenet@f.winkler-ka.de> - 2026-06-12 15:19 +0200
Re: Variable var names Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-13 02:51 +0000
Re: Variable var names Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2026-06-12 13:42 +0100
Re: Variable var names Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-06-12 17:41 +0200
Re: Variable var names Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-06-12 17:54 +0200
Re: Variable var names Frank Winkler <usenet@f.winkler-ka.de> - 2026-06-13 12:32 +0200
Re: Variable var names Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-14 01:12 +0000
Re: Variable var names Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-13 00:20 +0000
Re: Variable var names Kaz Kylheku <046-301-5902@kylheku.com> - 2026-06-23 21:25 +0000
Re: Variable var names Helmut Waitzmann <nn.throttle@erine.email> - 2026-06-24 10:45 +0200
Re: Variable var names Christian Weisgerber <naddy@mips.inka.de> - 2026-06-24 11:41 +0000
Page 2 of 2 — ← Prev page 1 [2]
| From | Helmut Waitzmann <nn.throttle@erine.email> |
|---|---|
| Date | 2026-06-24 10:45 +0200 |
| Message-ID | <83a4skz5q7.fsf@helmutwaitzmann.news.arcor.de> |
| In reply to | #26925 |
Kaz Kylheku <046-301-5902@kylheku.com>:
> It is also written that "If the command name is a special
> built-in utility, variable assignments shall affect the current
> execution environment before the utility is executed and remain
> in effect when the command completes". So in fact ksh is
> conforming, even though it is arguably a dumb behavior that Bash
> disagrees with (even in --posix mode; just tested with 4.4 and
> 5.1).
>
Interesting. In my Debian Linux system, “bash”
+ bash --version
GNU bash, version 5.1.4(1)-release (i686-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
obeys the POSIX standard in --posix mode as well as when invoked
with the name “sh”: The “bash” command
(
cmdline='
unset -v foo &&
foo=bar eval : &&
if ${foo+:} false
then
printf %s\\n posixly
else
printf %s\\n not\ posixly
fi' &&
for invocation in \
"$(
printf ' %q' \
exec -a bash -- bash -c "$cmdline" bash
)" \
"$(
printf ' %q' \
exec -a bash -- bash --posix -c "$cmdline" bash
)" \
"$(
printf ' %q' \
exec -a sh -- bash -c "$cmdline" sh
)"
do
eval set -- "$invocation" && echo &&
( set -x && "$@" )
done
)
yields the following output:
+ exec -a bash -- bash -c '
unset -v foo &&
foo=bar eval : &&
if ${foo+:} false
then
printf %s\\n posixly
else
printf %s\\n not\ posixly
fi' bash
not posixly
+ exec -a bash -- bash --posix -c '
unset -v foo &&
foo=bar eval : &&
if ${foo+:} false
then
printf %s\\n posixly
else
printf %s\\n not\ posixly
fi' bash
posixly
+ exec -a sh -- bash -c '
unset -v foo &&
foo=bar eval : &&
if ${foo+:} false
then
printf %s\\n posixly
else
printf %s\\n not\ posixly
fi' sh
posixly
[toc] | [prev] | [next] | [standalone]
| From | Christian Weisgerber <naddy@mips.inka.de> |
|---|---|
| Date | 2026-06-24 11:41 +0000 |
| Message-ID | <slrn113ngjb.3j2.naddy@lorvorc.mips.inka.de> |
| In reply to | #26925 |
On 2026-06-23, Kaz Kylheku <046-301-5902@kylheku.com> wrote: > It is also written that "If the command name is a special built-in > utility, variable assignments shall affect the current execution > environment before the utility is executed and remain in effect when the > command completes". So in fact ksh is conforming, even though it > is arguably a dumb behavior that Bash disagrees with (even in --posix > mode; just tested with 4.4 and 5.1). $ bash -c 'foo=bar eval : ; echo x$foo' x $ bash --posix -c 'foo=bar eval : ; echo x$foo' xbar $ bash -c 'echo $BASH_VERSION' 5.3.15(0)-release -- Christian "naddy" Weisgerber naddy@mips.inka.de
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.unix.shell
csiph-web