On 10/30/19 7:12 AM, Oğuz wrote:
> Since
>
> bash -c '${1##*""}' _ foo
>
> prints an empty line, I was expecting
>
> bash -c '${1##*"${1##*}"}' _ foo
>
> to print an empty line too, but instead it prints foo.
Thanks for the report. The shell doesn't handle the second quoted string
correctly. I
2019-10-30 14:12:41 +0300, Oğuz:
[...]
> I was expecting
>
> bash -c '${1##*"${1##*}"}' _ foo
>
> to print an empty line too, but instead it prints foo.
[...]
> Is this a bug?
Yes,
In gdb, we see the ${1##*} expands to \177 (CTLNUL) as a result
of quote_string(). And that's used as is in the ou
First two command lines lack "echo", sorry
On Wed, Oct 30, 2019 at 2:12 PM Oğuz wrote:
> Since
>
> bash -c '${1##*""}' _ foo
>
> prints an empty line, I was expecting
>
> bash -c '${1##*"${1##*}"}' _ foo
>
> to print an empty line too, but instead it prints foo.
>
> Other shells I could find don
Since
bash -c '${1##*""}' _ foo
prints an empty line, I was expecting
bash -c '${1##*"${1##*}"}' _ foo
to print an empty line too, but instead it prints foo.
Other shells I could find don't have this problem
$ sh -c 'echo "${1##*"${1##*}"}"' _ bar
$ ash -c 'echo "${1##*"${1##*}"}"' _ bar
$