Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15538 > unrolled thread

Parameter expansion resulting empty treated as if it's not empty

Started byOğuz <oguzismailuysal@gmail.com>
First post2019-10-30 14:12 +0300
Last post2019-10-30 14:12 +0300
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Parameter expansion resulting empty treated as if it's not empty Oğuz <oguzismailuysal@gmail.com> - 2019-10-30 14:12 +0300

#15538 — Parameter expansion resulting empty treated as if it's not empty

FromOğuz <oguzismailuysal@gmail.com>
Date2019-10-30 14:12 +0300
SubjectParameter expansion resulting empty treated as if it's not empty
Message-ID<mailman.43.1572433984.22196.bug-bash@gnu.org>
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?

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web