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


Groups > gnu.bash.bug > #15539

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

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Oğuz <oguzismailuysal@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Parameter expansion resulting empty treated as if it's not empty
Date Wed, 30 Oct 2019 14:14:43 +0300
Lines 36
Approved bug-bash@gnu.org
Message-ID <mailman.45.1572434100.22196.bug-bash@gnu.org> (permalink)
References <CAH7i3Lp79s5Kpe+kg6thQtqpaVai19HMoDW1SXNF9Ae71p7HGQ@mail.gmail.com> <CAH7i3Loshnfd7y_MLhRbPmhBVvwWoPBj3g8c-3zcyL2+duqoKQ@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1572434101 11415 209.51.188.17 (30 Oct 2019 11:15:01 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=3BpRJT14jwW63HU1Ok7maPpaDKoKlU7u4wMDXJROFzc=; b=fM4v2aHM65tFYrVMCNyf0tpeyScS3tFAdekPPTUKYEbSlzuPeuEH2JgrfqpdOF98pk 7SeNZ5yiAM4og/FC/7XJpJ1B0n8FZhYeyxrQWsDVoS/o3xW+V5ohQWT4T0F0yopbN02E NrZTTsOo2wwt8Jz/Oz+RjwbzG+vR4dslh9iZnU1K4DyZrdExLIiCAl8QmklkLPpYq+s0 +clf+QFqAhbv6WAS4fqnBsfiAFvm/mEuuQkr0V3CJayfUDgZBYzlwLKvG1NBkBVw5r9u 5SBMf1JTmH5MsIES+bL44JegXTHTW4YncYiJkSpPx6r9xBchxtutRwjjwl3CC2G9URof IAIw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=3BpRJT14jwW63HU1Ok7maPpaDKoKlU7u4wMDXJROFzc=; b=OJKAf6J0MuqC2o5FgnmyC2BR0fh4SFQ3BQVxFIcKyu7DGUZDTvtXBTWNFz89YaXYFs Oxi2W0yScXIa0kvrqavGPgE5UDBtdGjOcqUxb1FQ3BZeqpVRvju7SR8LydGhHcG+1f+p ZatdTW5UULhZPrFirryYtcYhRmybkKtK1zfpARkzAFftgOTrxOoNgdiJ7Sa9UJ2ga3Gn CRdE9nllzQ0oX4dmduCW7P7ALVm72qFbjDt1b9GHvxS5kBDmFO0ZpH7E+MhG80xKFhgl EkWr1HHt5Dlr+we0pokVGUsLpDSWU8xHl6kFEWZQEuGiuh0kd/AmlMvlNqKS6CxYWHR3 co6w==
X-Gm-Message-State APjAAAVtUOIsC4yi44EL24xyxqpjorDccXxDG3hb58o3T4UlD0+0OkqK 3SIYkcJmF7QgOjmIiF9R6HBovVYr4VCHFI1cRhzVCs4Ukbs=
X-Google-Smtp-Source APXvYqxHrQX/4LzjO8/WAqcHi6qSJMhQbJLZobhU9bwRRC1KjXCYacGRXlYhSG2UtBBNkK6FZ45CXJ6Hs4x99V9lmE4=
X-Received by 2002:a0c:c70a:: with SMTP id w10mr21326735qvi.222.1572434096738; Wed, 30 Oct 2019 04:14:56 -0700 (PDT)
In-Reply-To <CAH7i3Lp79s5Kpe+kg6thQtqpaVai19HMoDW1SXNF9Ae71p7HGQ@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::82b
X-Content-Filtered-By Mailman/MimeDel 2.1.23
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAH7i3Loshnfd7y_MLhRbPmhBVvwWoPBj3g8c-3zcyL2+duqoKQ@mail.gmail.com>
X-Mailman-Original-References <CAH7i3Lp79s5Kpe+kg6thQtqpaVai19HMoDW1SXNF9Ae71p7HGQ@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15539

Show key headers only | View raw


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?
>

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web