From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1IqGKO-0005jd-7j for garchives@archives.gentoo.org; Thu, 08 Nov 2007 22:58:24 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.2/8.14.0) with SMTP id lA8Mv0Rt011287; Thu, 8 Nov 2007 22:57:00 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by robin.gentoo.org (8.14.2/8.14.0) with ESMTP id lA8MrsaG006654 for ; Thu, 8 Nov 2007 22:53:55 GMT Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 89BC764F6B for ; Thu, 8 Nov 2007 22:53:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Score: -0.021 X-Spam-Level: X-Spam-Status: No, score=-0.021 required=5.5 tests=[AWL=0.511, BAYES_00=-2.599, RCVD_NUMERIC_HELO=2.067] Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OW3aRKBntS0d for ; Thu, 8 Nov 2007 22:53:47 +0000 (UTC) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id A642664F03 for ; Thu, 8 Nov 2007 22:53:46 +0000 (UTC) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IqGFo-0007c1-F4 for gentoo-dev@gentoo.org; Thu, 08 Nov 2007 22:53:40 +0000 Received: from 91.84.166.112 ([91.84.166.112]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Nov 2007 22:53:40 +0000 Received: from slong by 91.84.166.112 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Nov 2007 22:53:40 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-dev@lists.gentoo.org From: Steve Long Subject: [gentoo-dev] Re: New eclass: cmake-utils.eclass Date: Thu, 08 Nov 2007 22:57:26 +0000 Message-ID: References: <200709092115.17423.philantrop@gentoo.org> <47333764.2020503@necoro.eu> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 91.84.166.112 User-Agent: KNode/0.10.4 Sender: news Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by robin.gentoo.org id lA8Mv0Td011287 X-Archives-Salt: e478c3e4-9c65-4145-b027-3e4ab5dd979f X-Archives-Hash: cf50ad734d20d1e03a460446731df0c5 Ren=E9 'Necoro' Neumann wrote: > cmake-utils_src_enable python =3D> -DENABLE_python=3D... >=20 > Wanted would be that it returned -DENABLE_PYTHON=3D... >=20 > I'm not into bash scripting that much, so I do not know a way to do so = - > but I guess someone else is ;) >=20 Unfortunately BASH doesn't support ksh93 or zsh style casting to uppercas= e. The best way really is via tr: alias toUpper=3D'tr [[:lower:]] [[:upper:]]' alias toLower=3D'tr [[:upper:]] [[:lower:]]' (er aliases don't normally work in scripts, but you get the idea.) Bear i= n mind that tr reads stdin and writes to stdout. It has the advantage of being locale-safe. Every other method I've looked at is much slower and only works with ASCII. A function wouldn't be too hard: toUpper() { for i; do echo "$i" |tr [[:lower:]] [[:upper:]] done } Usage depends on the parameters you pass. var=3D$(toUpper $var) # for single vars with no newlines in for i in $(toUpper "$@"); do # for multiple, if just simple flags with no space, tabs or newlines. IFS=3D$'\n'; before the above would deal with anything but newlines in th= e vars. (We can get more complex but I doubt it's needed in this scope, muc= h as I hate leaving script in a technically unsafe state. If you're parsing filenames, this is *not* safe.) $ a=3D'blah blah' $ a=3D$(toUpper "$a") $ echo "$a" BLAH BLAH --=20 gentoo-dev@gentoo.org mailing list