Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Aug 2009 20:38:46 +0200
From:      Johan van Selst <johans@stack.nl>
To:        Doug Barton <dougb@FreeBSD.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Problem in bin/sh stripping the * character through ${expansion%}
Message-ID:  <20090806183846.GA68029@mud.stack.nl>
In-Reply-To: <4A7B1DB0.1040602@FreeBSD.org>
References:  <4A7B1DB0.1040602@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090806183846.GA68029>