---------- Forwarded message ---------
From: Victor Pasko <[email protected]>
Date: Fri, Oct 27, 2023 at 1:57 AM
Subject: Re: Strange results
To: Dennis Williamson <[email protected]>
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
--
-- PSK
--
-- PSK