bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "printf %d ''" should diagnose the empty string


From: Phi Debian
Subject: Re: "printf %d ''" should diagnose the empty string
Date: Mon, 10 Feb 2025 19:24:26 +0100

On Mon, Feb 10, 2025 at 5:34 PM Zachary Santer <zsanter@gmail.com> wrote:

>
> int_regex='([+-]?)0*([[:digit:]]+)'
> if [[ ${var} =~ ${int_regex} ]]; then
>   var="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
> else
>   printf '%s\n' "Argument '${var}' is not a valid integer" >&2
> fi
>

The error message should be 'not a valid signed decimal with leading zeros
constant'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]