[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parameter expansion resulting empty treated as if it's not empty
From: |
Oğuz |
Subject: |
Parameter expansion resulting empty treated as if it's not empty |
Date: |
Wed, 30 Oct 2019 14:12:41 +0300 |
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?
- Parameter expansion resulting empty treated as if it's not empty,
Oğuz <=