bug-bash
[Top][All Lists]
Advanced

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

Re: Strange results


From: alex xmb sw ratchev
Subject: Re: Strange results
Date: Thu, 26 Oct 2023 21:13:33 +0200

On Thu, Oct 26, 2023, 9:07 PM Victor Pasko <victor.pasko@gmail.com> wrote:

> ---------- Forwarded message ---------
> From: Victor Pasko <victor.pasko@gmail.com>
> Date: Fri, Oct 27, 2023 at 1:57 AM
> Subject: Re: Strange results
> To: Dennis Williamson <dennistwilliamson@gmail.com>
>
>
>
> Also
>
> echo10 ${ASCII_SET:$((-10)):1}
>
> and
>
> echo11 ${ASCII_SET:-10:1}
>
> have different behaviour:(
>
> Both of these say "output the character that's 10th from the end" which is
> > "u". What did you expect it to output?
> >
> > echo "echo11 ${ASCII_SET:-10:1}"
> >
>
> Firstly, expected the only one symbol from  ASCII_SET string
>
> This says, according to the man page:
> >
> >        ${parameter:-word}
> >               Use Default Values.  If parameter is unset or null, the
> > expansion of word is substituted.  Otherwise, the value of parameter is
> > substituted
> >
> > which means output "10:1" if ASCII_SET is unset or null. Since it isn't,
> > the contents of that variable are output giving you a long sequence of
> > ASCII characters.
> >
>
> But ASCII_SET is not unset so -word must not be used
>

there is no dash allowed as varname

-- 
>
> -- PSK
>
>
> --
>
> -- PSK
>


reply via email to

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