Thread View: muc.lists.netbsd.tech.userlevel
4 messages
4 total messages
Started by Edgar Fuß
Wed, 11 Nov 2026 15:24
sh: arithmetic: ++ operator unsupported
Author: Edgar Fuß
Date: Wed, 11 Nov 2026 15:24
Date: Wed, 11 Nov 2026 15:24
9 lines
1805 bytes
1805 bytes
I just noticed that /rescue/sh (at least the one from -6) doesn't know ++ in an Arithmetic Expansion. Is there a list what else /rescue/sh is missing (apart from vi mode)? And out of curiosity: why is it missing ++? -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: sh: arithmetic: ++ operator unsupported
Author: Martin Neitzel
Date: Wed, 11 Nov 2026 17:49
Date: Wed, 11 Nov 2026 17:49
27 lines
2900 bytes
2900 bytes
EF> I just noticed that /rescue/sh (at least the one from -6) doesn't know ++ EF> in an Arithmetic Expansion. FWIW: netbsd-9 /rescue/sh does support it. EF> And out of curiosity: why is it missing ++? I guess because it just ain't required by POSIX. Never was, still isn't. Shell & Utilities -> 2.6 Word Expansions -> 2.6.4 Arithmetic Expansion: The arithmetic expression shall be processed according to the rules given in 1.1.2.1 Arithmetic Precision and Operations, with the following exceptions: * Only signed long integer arithmetic is required. * Only the decimal-constant, octal-constant, and hexadecimal-constant constants specified in the ISO C standard, Section 6.4.4.1 are required to be recognized as constants. * The sizeof() operator and the prefix and postfix "++" and "--" operators are not required. * Selection, iteration, and jump statements are not supported. Martin -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: sh: arithmetic: ++ operator unsupported
Author: Robert Elz
Date: Thu, 12 Nov 2026 07:41
Date: Thu, 12 Nov 2026 07:41
43 lines
2593 bytes
2593 bytes
Date: Wed, 11 Nov 2026 16:24:32 +0100
From: Edgar Fuß <ef@math.uni-bonn.de>
Message-ID: <avSIsI6pjxOf2/9o@trav.math.uni-bonn.de>
| I just noticed that /rescue/sh (at least the one from -6) doesn't know ++
| in an Arithmetic Expansion.
Not a great surprise. -6 ???
| Is there a list what else /rescue/sh is missing (apart from vi mode)?
That (vi editing mode) probably shouldn't be missing, are you sure?
Did you "set -V" (along with setting TERM etc).
But ++ isn't missing from "/rescue/"sh in -6, it is missing from sh in -6
(maybe in -7 as well, I don't remember the timeline).
There should be little missing from /rescue/sh that is in /bin/sh in
general - the obvious one is, that, as it is statically linked, it has
even less locale support than /bin/sh does.
But any /bin/sh from NetBSD 6 is going to be full of bugs (though most
of them wouldn't affect normal operations - NetBSD had been using even
more bug ridden versions for a couple of decades by then).
| And out of curiosity: why is it missing ++?
No-one had bothered to implement it? ++ wasn't, and still isn't,
a POSIX required operator in shell arithmetic (and -- of course).
If it helps, it got implemented (along with the ',' operator, also
not required) in late(ish) July 2017.
kre
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: sh: arithmetic: ++ operator unsupported
Author: Edgar Fuß
Date: Thu, 12 Nov 2026 15:13
Date: Thu, 12 Nov 2026 15:13
26 lines
2817 bytes
2817 bytes
> Not a great surprise. -6 ??? Sorry, it's from 8.2. I keep that old /rescue because I can switch that machine between -8, -10 and -11 (I skipped -9): I have an -8 installation in /8, /usr/8 and /var/8 (plus null mounts for that latter on /8/usr resp. /8/var), same for s/8/10/ (and, currently empty, for 11) and a shell script that can swap (given a configuration file knowing what to swap), i.e. /bin->/11/bin and /10/bin->/bin and I need the lowest supported version in /rescue as I do the swap in single user mode with /rescue/sh (and PATH=/rescue) plus /rescue/reboot. > That (vi editing mode) probably shouldn't be missing, are you sure? > Did you "set -V" (along with setting TERM etc). Sorry again, it's actually built in. > But ++ isn't missing from "/rescue/"sh in -6, it is missing from sh in -6 > (maybe in -7 as well, I don't remember the timeline). Ah, I see. But it's also missing from sh in 8.2. > No-one had bothered to implement it? ++ wasn't, and still isn't, > a POSIX required operator in shell arithmetic (and -- of course). Sorry once again, I missed that. -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads