moving upper case names to lower case -- Followups to comp.unix.questions

Marshall Cline cline at sun.soe.clarkson.edu
Thu Aug 24 05:22:10 AEST 1989


>>In article <20672 at adm.BRL.MIL> Leisner.Henr at xerox.com (Marty) writes:
>>>I'm looking for a good, clean way to move files from upper case names
>>>to lower case names. i.e. FOO.C to foo.c
>>>I could always right a C program, but there gotta be a better way.

>In article <9326 at chinet.chi.il.us>, john at chinet.chi.il.us (John Mundt) writes:
>>#include <stdio.h>
>>#include <ctype.h>
>>main()
>>{	register int c;
>> 	while ((c = getchar()) != EOF) putchar(tolower(c));
>>}

In article <2336 at oakhill.UUCP> stevenw at oakhill.UUCP (Steven Weintraub) writes:
>I should point out there is a risk in using tolower like this.  Some
>machines define tolower as ((c)-'A'+'a') (like some sun systems).
                                                     ^^^
The Gould UTX systems also do this ------------------
Ie: tolower() does exactly what TurboC calls _tolower() -- it _assumes_ its
arg is an upper case letter...

As an answer to the original question (converting files to lowercase),
a simple csh script will do:
	#! /bin/csh -f
	foreach file ($*)
		mv $file `echo $file | tr A-Z a-z`
	end

Marshall
--
	__________________________________________________________________
	Marshall P. Cline	Internet: cline at sun.soe.clarkson.edu
	ECE Department		Usenet:   uunet!sun.soe.clarkson.edu!cline
	Clarkson University	Bitnet:   BH0W at CLUTX
	Potsdam, NY  13676	AT&T:     315-268-6591



More information about the Comp.unix.questions mailing list