[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Parameter expansion resulting empty treated as if it's not empty
From: |
Oğuz |
Subject: |
Re: Parameter expansion resulting empty treated as if it's not empty |
Date: |
Wed, 30 Oct 2019 14:14:43 +0300 |
First two command lines lack "echo", sorry
On Wed, Oct 30, 2019 at 2:12 PM Oğuz <oguzismailuysal@gmail.com> 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't have this problem
>
> $ sh -c 'echo "${1##*"${1##*}"}"' _ bar
>
> $ ash -c 'echo "${1##*"${1##*}"}"' _ bar
>
> $ dash -c 'echo "${1##*"${1##*}"}"' _ bar
>
> $ ksh -c 'echo "${1##*"${1##*}"}"' _ bar
>
> $ yash -c 'echo "${1##*"${1##*}"}"' _ bar
>
> $ zsh -c 'echo "${1##*"${1##*}"}"' _ bar
>
> $ bash -c 'echo "${1##*"${1##*}"}"' _ bar
> bar
> $ bash --posix -c 'echo "${1##*"${1##*}"}"' _ bar
> bar
>
> Is this a bug?
>