Re: Suggested BASH Improvement

2024-09-18 Thread Chet Ramey
On 9/18/24 1:10 PM, Greg Wooledge wrote: Thanks for the proposal. I think the [base#]n syntax is reasonable here without adding a new shell option. Do recall, however, that negative numbers break the workaround suggested by Andreas. $((10#${line:12:2})) Not part of the original problem

Re: Suggested BASH Improvement

2024-09-18 Thread Greg Wooledge
On Wed, Sep 18, 2024 at 10:51:51 -0400, Chet Ramey wrote: > On 9/17/24 7:50 PM, BRUCE FOWLER via Bug reports for the GNU Bourne Again > SHell wrote: > > An interesting problem I ran into recently: > > I have a shell script that I run about once a month that > > "screen-scrapes" from the output of a

Re: Suggested BASH Improvement

2024-09-18 Thread Chet Ramey
On 9/17/24 7:50 PM, BRUCE FOWLER via Bug reports for the GNU Bourne Again SHell wrote: An interesting problem I ran into recently: I have a shell script that I run about once a month that "screen-scrapes" from the output of another program using the substring capability, e.g. ${data_line:12:2

Re: Suggested BASH Improvement

2024-09-18 Thread Andreas Schwab
On Sep 17 2024, BRUCE FOWLER via Bug reports for the GNU Bourne Again SHell wrote: > of C-language compatibility. I could use the [base#]n form > but that gets awkward. Why is that awkward? It's a general solution to a general problem, and does not require any new features. > Even the venerabl

Re: Suggested BASH Improvement

2024-09-17 Thread alex xmb sw ratchev
another is ${var##0} On Wednesday, September 18, 2024, BRUCE FOWLER via Bug reports for the GNU Bourne Again SHell wrote: > An interesting problem I ran into recently: > > I have a shell script that I run about once a month that > "screen-scrapes" from the output of another program using the > s

Suggested BASH Improvement

2024-09-17 Thread BRUCE FOWLER via Bug reports for the GNU Bourne Again SHell
An interesting problem I ran into recently: I have a shell script that I run about once a month that "screen-scrapes" from the output of another program using the substring capability, e.g. ${data_line:12:2}. This is pulling out the two-digit month ranging from "01" to "12". This worked fine, e