Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: =?UTF-8?B?T8SfdXo=?= Newsgroups: gnu.bash.bug Subject: Parameter expansion resulting empty treated as if it's not empty Date: Wed, 30 Oct 2019 14:12:41 +0300 Lines: 30 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1572433984 11401 209.51.188.17 (30 Oct 2019 11:13:04 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:from:date:message-id:subject:to; bh=1RwXH2bbLn0nea540d378c0I78e9KnwQQTYC+XJFrsA=; b=PQLgcB+FAnMxtfkMYsH9l9mxZupwTt0ogEL9xbSyCALTGDUEHE8HtKEnPh8bxxqMZG 63vNv9QSF5J3gQq5nGxaC3L/9woeTlM4tZbD0d9W4h0yTTamuFa7V4RA/4W/iZbLCUve jNxVCQJgrInKXM9F51gTtkm9NYCJGSbnMoHPA3NGV7mNJRX4yEuCNMm/ls4COsnh8zt/ TrcnQvUC12phdHRMEIFaei80gllnoinmZPGTK3hpaLZsqDSq/hV0X+QLwbkHuClNSTzG C0ooeXAzkRMm0J9T2epMfvU7j+SGWm3dbfxdB89oZK+yMwHP5amb+8zUUorck7lCIXj1 ufnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=1RwXH2bbLn0nea540d378c0I78e9KnwQQTYC+XJFrsA=; b=TWWWJLM0UJOYAhW6Gz6Tt6EE4+IUcGL2GGBiXtR7YdDyeaDhAopRmHfPCdlbWPbzG6 HhOXGBcxawRacN5L8ulhVEI/Rvao3THvED4Tda4YJWxqgIbeI9XPQf7lSootXaHoDa9u 6GidtnaheKsk/u//QGWSf0g0CEFZcTt3Ln1CpPzTLlY+7ZpOOssGwf3D9dCLyXkF7A+W NgJIwvRt9+NPSeIPrcRmkVcQVbb0FyrurDgXv8bw8Wzv2w0+h+yq8pvlHONYclNOImfN iQK7m6WQ57GmlvGVBl1qlNeaFlJa+aqZsqXPFL+HXnyjt2g1rOyYlcL4Z49csLLAKh/l Trfg== X-Gm-Message-State: APjAAAWbsSJy40Ow5n3Dm7Y87Qph/78vFKDX2sIITdAc27kLe3/c2iFJ uIJ4PbGrm3mcSpMhPJncLyvO9OMDWGx1+eigg+NrkE6quZEtPA== X-Google-Smtp-Source: APXvYqxtUQsdzd/o9w5Lx18pgfATvzf4CCGIAQXZM8/lJ3eG2z4fhzFrzZl7PSOMyuqXjCPtfZotDJXPJAtGIwOqCAc= X-Received: by 2002:a37:ab04:: with SMTP id u4mr27188686qke.114.1572433974360; Wed, 30 Oct 2019 04:12:54 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::732 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.bash.bug:15538 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?