From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19733 invoked by alias); 7 Nov 2012 19:41:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30782 Received: (qmail 22031 invoked from network); 7 Nov 2012 19:41:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_NJABL_PROXY,T_DKIM_INVALID autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:x-x-sender:to:subject:message-id:user-agent :mime-version:content-type; bh=qDQNCnBj4QKgHc+ejVQcoV32Pa2x353t7sGoWHThGRI=; b=cxsYwOjSQz8Vf9X2EhgtRvBvzbOHh1I0VjmQoVntdjx2Y6neYss+bNdloDOXbyYweK jShmrxLEu1dAcJkF9YZUtx8W8jNLHRSqN2p8x98sO3QPlzqmW7ooebl9xCgj3Zm/ypKO Menr7RS7UHBArtT2XCkcPbnn/6vvWLiRTh1NnZ4IS0rjKZiSDLj2PgpzYqkS7x/kP2I5 GHo6tTHNfWi4YKEhmTPx9czPpiuUAwAQ/ZWEcrCABQbf2d0L6XwoiTNtffK3km75s4O4 upIni4R+JiwUq4cYAsMztnvh/H0xIhNtUtuhU4aUtoP5MqgmwZF6fXrwXCiehW7+f/m8 x+9Q== Sender: Scott Moser Date: Wed, 7 Nov 2012 14:13:36 -0500 (EST) From: Scott Moser X-X-Sender: smoser@brickies To: zsh-workers@zsh.org Subject: bug in parameter expansion Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII This issue was initially reported against shell code delivered in cloud-init at [1], but it seems to me to be a bug in zsh's posix shell behavior. $ for shell in /bin/dash /bin/bash /bin/ksh /bin/zsh; do \ echo "=== $shell ==="; $shell -c 'echo "${1%%=*}"' \ -- A=B; done === /bin/dash === A === /bin/bash === A === /bin/ksh === A === /bin/zsh === zsh:1: * not found It also has the issue when matching prefix (#): $ zsh -c 'echo ${1#=?}' -- =AB zsh:1: ? not found $ bash -c 'echo ${1#=?}' -- =AB B It is seemingly easily worked around by escaping the '=' like: $ zsh -c 'echo "${1%%\=*}"' -- A=B A or: zsh -c 'equal="="; echo "${1%%${equal}*}"' -- A=B A Scott -- [1] https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1073077