From owner-freebsd-current@FreeBSD.ORG Fri Mar 26 02:44:17 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 832FA16A4CE for ; Fri, 26 Mar 2004 02:44:17 -0800 (PST) Received: from cmsrelay03.mx.net (cmsrelay03.mx.net [165.212.11.112]) by mx1.FreeBSD.org (Postfix) with SMTP id 3EECD43D48 for ; Fri, 26 Mar 2004 02:44:17 -0800 (PST) (envelope-from noackjr@alumni.rice.edu) Received: from cmsapps01.cms.usa.net (165.212.11.136) by cmsoutbound.mx.net with SMTP; 26 Mar 2004 10:44:12 -0000 Received: from optimator.noacks.org [65.69.2.212] by cmsapps01.cms.usa.net (ASMTP/noackjr@usa.net) via mtad (C8.MAIN.3.13N) with ESMTP id 857icZkSk0131M36; Fri, 26 Mar 2004 10:44:10 GMT X-USANET-Auth: 65.69.2.212 AUTH noackjr@usa.net optimator.noacks.org Received: from localhost (localhost [127.0.0.1]) by optimator.noacks.org (Postfix) with ESMTP id 12E706101; Fri, 26 Mar 2004 04:44:10 -0600 (CST) Received: from optimator.noacks.org ([127.0.0.1]) by localhost (optimator.noacks.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 07087-06; Fri, 26 Mar 2004 04:44:09 -0600 (CST) Received: from alumni.rice.edu (compgeek [192.168.1.10]) by optimator.noacks.org (Postfix) with ESMTP id E6EF560FC; Fri, 26 Mar 2004 04:44:08 -0600 (CST) Message-ID: <4064098C.1090208@alumni.rice.edu> Date: Fri, 26 Mar 2004 04:44:28 -0600 From: Jon Noack User-Agent: Mozilla Thunderbird 0.5+ (Windows/20040312) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Reifenberger References: <20040326085219.T24707@fw.reifenberger.com> <4063EE4E.3090102@alumni.rice.edu> <20040326110609.O24707@fw.reifenberger.com> In-Reply-To: <20040326110609.O24707@fw.reifenberger.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at noacks.org cc: freebsd-current@freebsd.org Subject: Re: strange tr behaviour X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: noackjr@alumni.rice.edu List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2004 10:44:17 -0000 On 3/26/2004 4:09 AM, Michael Reifenberger wrote: > On Fri, 26 Mar 2004, Jon Noack wrote: >> Short version: >> tr(1) was modified to be POSIX compliant for 5.x. You are seeing >> correct behavior. See the solution below. > > Thanks all for the hints. > > Only that tr(1) states: > ... > COMPATIBILITY > System V has historically implemented character ranges using the syntax > ``[c-c]'' instead of the ``c-c'' used by historic BSD implementations and > standardized by POSIX. System V shell scripts should work under this > implementation as long as the range is intended to map in another range, > i.e. the command ``tr [a-z] [A-Z]'' will work as it will map the ``['' > character in string1 to the ``['' character in string2. However, if the > ... > > So I just expected the historic behaviour so that [a-z] map to [A-Z] > as before :-( From tr(2): c-c For non-octal range endpoints represents the range of charac- ters between the range endpoints, inclusive, in ascending order, as defined by the collation sequence. It's translating _ranges_. To help understand this: $ echo abcdef | tr a-z A-D ABCDDD The first range (a-z) is larger than the second (A-D), so it does a one-to-one mapping until it hits the end of the second range. At that point it must just use the final character from the second range. In your locale, the range a-z is smaller than the range A-Z. Thus, the one-to-one mappings won't result in proper case conversion. Perhaps tr(2) should be updated to say something about this. Jon