Re: why "shopt -p" sometime return non-zero ?

2025-09-24 Thread Stan Marsh
>shopt -p extglob >/dev/null; s_extglob=$? >shopt -s extglob >( do processing ) >((s_extglob==1)) && shopt -u extglob >I must think before posting. This still doesn't get over the fact >that you've 'set -e' Right - that's exactly the point. Since OP is running "set -e", he should use a con

Re: About fltexpr

2025-09-21 Thread Stan Marsh
>Could fltexpr maybe link to some other libm that is correctly rounded, >like GNU MPFR, or LLVM's libm, to mention just a few? I doubt they'd want to make bash dependent on any external library like that (that may or may not be installed on a given system). But you are certainly welcome to take a

Re: About fltexpr

2025-09-21 Thread Stan Marsh
> Otherwise, you're *always* going to run into issues of this type. I'm not. OP might - unless/until he reads and understands the "What every ..." document. = Please do not send me replies to my posts on the list. I

Re: About fltexpr

2025-09-21 Thread Stan Marsh
>Bourne Again SHell wrote: >> $ fltexpr -p "0.1 + 0.2" >> 0.30004 >> https://0.30004.com/ Of course there are no bugs in the OP and, of course, just about everything there is covered by the usual "What every computer programmer should know about floating point math" clic

Re: [PATCH 2/7] doc/bash.1: Document deprecated syntax for arithmetic evaluation

2025-09-21 Thread Stan Marsh
>> >> +The old format \fB$[\fP\fIexpression\fP\fB]\fP is deprecated and will >> +be removed in upcoming versions of bash. >> >That's not true though, both bash and zsh still support it and neither >party plan to remove it. It's better left undocumented. I disagree that it should be left undocumen

Re: [PATCH] examples/s-f/Bash_aliases: Fix off-by-one error

2025-09-21 Thread Stan Marsh
>>Sure, except this isn't a script. It's in a file named Bash_aliases >>contained in a directory named examples/startup-files. It was clearly >>intended to be copied into one's ~/.bashrc file (or to be dotted in >>from there). >>Including it in your ~/.bashrc would effectively mask the real se

Re: [PATCH] examples/s-f/Bash_aliases: Fix off-by-one error

2025-09-21 Thread Stan Marsh
>May be the 'repeat' function in the 'examples' is a bit lengthy, and use >subshells, the example I got is ... I think all of the files in the examples/startup-files directory should be treated as museum pieces. You wouldn't go into a museum and start insisting that all the displays be changed

Re: [PATCH] examples/s-f/Bash_aliases: Fix off-by-one error

2025-09-20 Thread Stan Marsh
> On my machines (Slack 15 / LMDE 6) 'seq 100' prints a line 100 times. > seq is an elf binary, not a function repeat doesn't exist as an > executable or function. To fix that, you need to "dot" (aka, "source") the file Bash_aliases, which you will find in the "examples/startup-files" subdirecto

[PATCH] examples/s-f/Bash_aliases: Fix off-by-one error

2025-09-20 Thread Stan Marsh
Very entertaining thread! Blast from the past! Regarding the fundamental question of "Is this a bug or not?", note that in computer stuff, yeah, most people's intuitive idea of what "repeat n times" means is "Do it n times". And most implementations I've seen of a "repeat" keyword in programming h

Re: A problem with the read command

2025-09-16 Thread Stan Marsh
>What, no takers? Come on, guys, that can't be normal for the read >command to get stuck like that. After all, I've given it the timeout >option, "read -t 1", which means, "In one second, read-or-not, be out >of there!", does it not? There must be something I could do to avoid >getting stuck like t

Re: [bug #67486] Can't use if with two separate awk floating number ...

2025-09-12 Thread Stan Marsh
For the benefit of anyone trying to follow this thread, code in question seems to be: >if awk '{exit $1 < $2 ? 0 : 1;}' <<< '1.1 1.2' && awk '{exit $1 < $2 ? 0 : >1;}' <<< '1.3 1.4' >then > echo ok >fi Actually, that is correct code - that actually works, although no one would ever do it like

Airing dirty laundry on a technical mailing list

2025-09-11 Thread Stan Marsh
tl;dr: This really has no place being discussed in public. Whatever differences Individual 1 and Individual 2 have, they should be hashed out in private email. Or they should step outside and settle it like the manly men they are. I do have a strong opinion as to who is right and who is wrong, b

Re: A question about the bash loadables

2025-09-05 Thread Stan Marsh
>> On 9/1/25 10:24 AM, pourko--- via Bug reports for the GNU Bourne >> Again SHell wrote: >> > Is there any possible (easy) way of transforming a bash loadable >> > into a bash builtin? >> >> Sure. You just have to convert the information in the `xxx_doc' array >> and the `xxx_struct' structure

Re: A BUG in bash-5.3 and extglob

2025-09-03 Thread Stan Marsh
>>Maybe it changed between 5.3 rc2 and 5.3 release. 5.3 rc2 was compiled as >>is; no >>local changes. >It didn't. I could disprove this, but as I said before, it is not worth arguing about. I'm surprised people are still posting about it. ===

Re: Bash exits with "Broken pipe" with process subsitution and sleep

2025-09-03 Thread Stan Marsh
>>The crux of the confusion is the difficulty in identifying when >>subprocesses are created. >>- Brackets always ensure a subshell. >Parentheses. Brackets are [ and ] in bash and POSIX nomenclature. I think Europeans (**) often call them (*) "brackets". I've noticed this a lot over the ye

Re: A BUG in bash-5.3 and extglob

2025-08-31 Thread Stan Marsh
Maybe it changed between 5.3 rc2 and 5.3 release. 5.3 rc2 was compiled as is; no local changes. Anyway, it is what it is. Doesn't matter. Not worth arguing about. = Please do not send me replies to my posts on the

Re: A BUG in bash-5.3 and extglob

2025-08-31 Thread Stan Marsh
(>> == pourko, > == Greg) >> Sorry, Greg, but this is no "compound" command, these are separate commands: >> >> $ shopt -s extglob; echo !(this) >That is another case where it fails, correct. >However, in your original email, you did indeed have the shopt inside >a compound command. That's why

Re: [PATCH] command substitution with trailing newlines (was Re: [PATCH] Add

2025-08-30 Thread Stan Marsh
>> If the feature is really desired by the community as an essential feature, it >> should be implemented as a new syntax. >I looked at adding alternate syntax for doing command substitution without >stripping trailing newlines, and it turned out to be easier than I expected. >This patch adds t

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Stan Marsh
>> This has never been documented. >> >If that's true, how are there scripts using it, and people asking about it? >It's not just documentation that you've written that needs to be >considered, because clearly this feature must be mentioned SOMEWHERE. Yeah, that occurred to me as well, but I j

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-27 Thread Stan Marsh
Connor wrote: > I'm of the opinion that if there is a supported feature with no plans for > deprecation > or removal, it should be documented. Even if it's not widely used, it's still > supported with (as you said) no plans for removal. reply via email to I'm of the opinion that the feature in q

Re: Feature request (not a bug): enhanced variable substitutions would be nice.

2025-08-08 Thread Stan Marsh
Just for kicks, here's an implementation of "if-then-else" called "ite", as a function. Note that: 1) It is pretty much a drop in for the missing functionality (in the usual ${var:X} syntax), when used inside $(). 2) All of the existing ${var:X} syntaxes are special cases of ite(

Re: [bug #67410] Bash read fails on UTF-8

2025-08-08 Thread Stan Marsh
>I think they meant to use IFS=$'\n' rather than IFS='\n' In which sense of the word "they" (*) ? In which sense of the word "meant" ? (**) (*) I'm pretty sure there's just one poster, not a bunch of them. (**) I'm pretty sure there was no typo or mechanical error when he posted to the list. ==

Re: Feature request (not a bug): enhanced variable substitutions would be nice.

2025-08-05 Thread Stan Marsh
Martin wrote: >On Tue, 5 Aug 2025 at 02:17, Stan Marsh wrote: >> (I am talking about things like ${var:-default value}) >> >> I have long wished there was a substitution for "substitute a string if var >> is >> unset else substitute nothing". >I&#x

Feature request (not a bug): enhanced variable substitutions would be nice.

2025-08-04 Thread Stan Marsh
(I am talking about things like ${var:-default value}) I have long wished there was a substitution for "substitute a string if var is unset else substitute nothing". This would basically be the inverse of :+, which means substitute a string if the var is set (ignoring the actual value of the v

Re: ./configure --help should print how to alter the default behaviour

2025-08-01 Thread Stan Marsh
What's with the spate of meaningless noise responses on this thread? Really, folks, you need to get a grip! As to the substance of this thread, yeah, if you carefully read the INSTALL file (as I did this afternoon), it is all there, but it is not a particularly easy read. I get where OP is comi

Re: cd: null directory

2025-07-30 Thread Stan Marsh
>It is not a bug. >> The SUS[1] says "If directory is an empty string, >> the results are unspecified.". >> >> [...] >> >> [1]: >> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html >This was changed in POSIX.1-2024: >If _directory_ is a

Re: Segfault when running alias if PROMPT_COMMAND is not empty

2025-07-07 Thread Stan Marsh
>From: Carl Johnson >Subject: Re: Segfault when running alias if PROMPT_COMMAND is not empty >Date: Mon, 7 Jul 2025 22:18:30 +0300 >> Thanks for the report. In the general case, evaluating the value of a shell >> variable as a command should save and restore the parser state. In this >> edg

Re: parser bug in Q_ARITH

2025-06-30 Thread Stan Marsh
(I wrote): >> It seems to me that there is never any need for $ in arithmetic contexts, so >> the >> obvious fix would be to just remove any $ found between (( and )). But from >> what I >> understand that is easier said than done. (Causing Greg to write): >Unfortunately, that's not true. Yo

Re: Typo in Bash Reference Manual

2025-06-30 Thread Stan Marsh
(I wrote): >> https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_06_02 >> I don't read POSIX specs. I have people who read POSIX specs. (And Chet wrote): > Consider asking them first. They're your people, after all. Good one! Well done.

Re: parser bug in Q_ARITH

2025-06-30 Thread Stan Marsh
On 6/30/25 5:06 AM, Isabella Bosia wrote: >>this causes a parser error since commit 35bc7025 >>a=(0 1 2) >>b=(0 1 2) >>x=0 >>((i=$x,a[b[i]])) >>using $ anywhere in (( )) makes subscripts not expandable (And then Chet wrote): >This was one of the results of this 2021 discussion: >https://lis

Re: Typo in Bash Reference Manual

2025-06-30 Thread Stan Marsh
(I wrote): >> I always thought the "colon-free" versions of the P.E. was a bash-ism, but >> experimentation shows that it works in "dash" as well. And "man dash" >> contains >> the following text: >> In the parameter expansions shown previously, use of the colon in the >> format >> results

Re: Typo in Bash Reference Manual

2025-06-29 Thread Stan Marsh
And here is another interesting thing inspired by this thread. I always thought the "colon-free" versions of the P.E. was a bash-ism, but experimentation shows that it works in "dash" as well. And "man dash" contains the following text: In the parameter expansions shown previously, use of the

Re: Typo in Bash Reference Manual

2025-06-29 Thread Stan Marsh
>"Note that a negative offset must be separated from the [non-following] >colon by at least one space to avoid being confused with the ':-' >expansion,' since a negative offset can exist immediately beside a >subsequent colon. >Wiley Note, incidentally, that it is not strictly true that a negat

Segmentation fault and code execution.

2025-06-18 Thread Stan Marsh
This is a "Doctor, it hurts when I do this" type thing. The short answer is that alias substitution occurs very early, so when you type: alias x='this and that' x() { ... } you are for all practical purposes, typing: 'this and that'() { ... } At which point, anything can happen. I

Re: bash 5.3, rc2, "make install" does not populate the share/man/man1 directory

2025-06-14 Thread Stan Marsh
(Followup to my previous post) To answer my own question, I guess it is pretty obvious that the answer to "How to fix?" is "Install texinfo and re-run the make install", but it raises two important questions: 1) Why is the error ignored, making it almost impossible to determine that

Re: bash 5.3, rc2, "make install" does not populate the share/man/man1 directory

2025-06-14 Thread Stan Marsh
I found the problem (I think). See below: --- Cut Here --- make[1]: Entering directory '/home/username/Build/bash-5.3-rc2/doc' rm -f bashref.info makeinfo --no-split -I../lib/readline/doc ./bashref.texi make[1]: makeinfo: Command not found Makefile:181: recipe for target 'bashref.info' failed mak

bash 5.3, rc2, "make install" does not populate the share/man/man1 directory

2025-06-13 Thread Stan Marsh
I did: ./configure --prefix=$HOME/local/bash5 Then make and then make install (all of this is done as a non-root user). It created the directory listed above and all the necessary subdirs, including share/man/man1, but left that directory empty. Shouldn't (at least) a copy of "bash.1" have been p

Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"]

2025-06-13 Thread Stan Marsh
On Fri, Jun 13, 2025 at 07:08:21 -0600, Stan Marsh wrote: > BTW, and only tangentially related, "man bash" says that "let" and "(( ))" are > exactly the same, but "shellcheck" thinks otherwise. "shellcheck" says you > should > use &qu

Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"]

2025-06-13 Thread Stan Marsh
>All of this is intentional, and not a bug. It is possible to be both. But, yes, it reflects a fundamental inconsistency in the C/Unix ecosystem. The fact that in most programming languages (e.g., C, AWK), 0 means false and non-zero means true, but in the shell, it is the opposite. E.g., in AWK

Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"]

2025-06-13 Thread Stan Marsh
>Description: >The shorthands "++", "--", "+=1" and "-=1" in bash arithmetic >erroneously return exit code 1 when a variable is either incremented by >"++" or decremented by "--" from 0 or incremented by "+=1" or decremented >by "-=1" from -1 and 1 respectively, although the variable valu

Re: Meta: `help cut` doesn't document what -a does

2025-06-13 Thread Stan Marsh
On Wed, Jun 11, 2025 at 10:38:17AM -0400, Chet Ramey wrote: > The business of installing the loadables and > headers on `make install' came later as the result of feature requests. > And Duncan, correctly, replied: >Fine for `make install' to *install* them. But it flies in the face of >convention

Re: Building bash 5.3, rc2, warning about mktemp()

2025-06-10 Thread Stan Marsh
Somebody flitted: > Nah This is not an answer. This is just someone blowing off steam. = Please do not send me replies to my posts on the list. I always read the replies via the web archive, so CC'ing to me is unnec

Building bash 5.3, rc2, warning about mktemp()

2025-06-10 Thread Stan Marsh
See below. As far as I can tell, it built OK. Should I be concerned about the warning? --- Cut Here --- rm -f bash gcc -std=gnu11 -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde -L./lib/malloc -L./lib/sh -rdynamic -g -O2 -o bash shell.o eval.o y.tab.o general.o make

Meta: `help cut` doesn't document what -a does

2025-06-06 Thread Stan Marsh
>On Thu, Jun 5, 2025, at 8:37 AM, Stan Marsh wrote: >> Actually, I am not too fond of the habit of having builtins (particularly >> those supplied as part of the distribution) with the same name as well-known >> Unix commands. > >It allows for potential drop-in replaceme

Re: `help cut` doesn`t document what -a does

2025-06-05 Thread Stan Marsh
On Thu, Jun 5, 2025, 12:56 PM Greg Wooledge wrote: > On Thu, Jun 05, 2025 at 12:34:44 +0200, microsuxx wrote: > > i installed bash dev , but there is no `help cut` > > It's a "loadable builtin". You have to build those, install them, > and then load the "cut" builtin explicitly. It was far fro

grouping via {} fails after "test $PIPESTATUS"

2025-05-29 Thread Stan Marsh
I think most of what needs to be said about the technical aspects of this user's question has been said. But I want to make a few suggestions for future practice, both for this mailing list and for the OP. In the gawk-bug list (which is structured very much like this list), they have a setup wh

Problem with vi mode in bash 5.0 beta

2018-12-12 Thread Stan Marsh
(This is all after doing "set -o vi") In previous versions of bash, I could do the following keys: / ^ foo and it would find the most recent command that starts with foo. This is all as expected. However, in bash 5.0 beta (self-compiled), this doesn't work. It always leaves the cursor line e