From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 6 18:38:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04926106566C; Thu, 6 Aug 2009 18:38:50 +0000 (UTC) (envelope-from johans@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id B1E8E8FC15; Thu, 6 Aug 2009 18:38:49 +0000 (UTC) Received: by mx1.stack.nl (Postfix, from userid 65534) id 8D6AC35A860; Thu, 6 Aug 2009 20:38:48 +0200 (CEST) X-Spam-DCC: CTc-dcc1: scanner01.stack.nl 1030; Body=1 Fuz1=1 Fuz2=1 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on scanner01.stack.nl X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Relay-Country: _RELAYCOUNTRY_ Received: from mud.stack.nl (mud.stack.nl [IPv6:2001:610:1108:5011:230:48ff:fe12:2794]) by mx1.stack.nl (Postfix) with ESMTP id C3B5135A859; Thu, 6 Aug 2009 20:38:46 +0200 (CEST) Received: by mud.stack.nl (Postfix, from userid 801) id 7A0A611453; Thu, 6 Aug 2009 20:38:46 +0200 (CEST) Date: Thu, 6 Aug 2009 20:38:46 +0200 From: Johan van Selst To: Doug Barton Message-ID: <20090806183846.GA68029@mud.stack.nl> References: <4A7B1DB0.1040602@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline In-Reply-To: <4A7B1DB0.1040602@FreeBSD.org> User-Agent: Mutt/1.5.19 (2009-01-14) Cc: freebsd-hackers@freebsd.org Subject: Re: Problem in bin/sh stripping the * character through ${expansion%} X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2009 18:38:50 -0000 --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Doug Barton wrote: > I came across this problem during a recent portmaster update. When > trying to strip off the * character using variable expansion in bin/sh > it doesn't work. Other "special" characters do work if they are > properly escaped. Your script does var=${var%\*} When I tried it myself, I automatically typed quotes, which does work var="${var%\*}" Alternatively you could use (with or without quotes) var="${var%[*]}" Still, I don't see a reason why your variant shouldn't work as well.. Regards, Johan --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- iEYEAREIAAYFAkp7IzYACgkQaOElK32lxTsw/gCghk8rSF8E9/zmmMtl5A+Onnwg 7dYAn0PIB42NH47BX6bm/6oIromzEilm =/nb/ -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs--