From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cpe002078d3b1ec-cm400045879001.cpe.net.cable.rogers.com ([24.102.187.22] helo=.interfree.ca) by speech.braille.uwo.ca with esmtp (Exim 3.36 #1 (Debian)) id 1AJPkL-000272-00 for ; Mon, 10 Nov 2003 23:03:22 -0500 Received: from gate ([192.168.1.1] helo=M019005) by .interfree.ca with smtp (Exim 3.35 #1 (Debian)) id 1AJPjz-0000GK-00 for ; Mon, 10 Nov 2003 23:02:55 -0500 Message-ID: <001d01c3a808$b6e065b0$6901a8c0@ism.can.ibm.com> From: "Rejean Proulx" To: "Speakup is a screen review system for Linux." References: Date: Mon, 10 Nov 2003 23:03:07 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: Re: Mixed Case Directory Names X-BeenThere: speakup@braille.uwo.ca X-Mailman-Version: 2.1.3 Precedence: list Reply-To: "Speakup is a screen review system for Linux." List-Id: Speakup is a screen review system for Linux. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2003 04:03:24 -0000 i tried it and it didn't change directories. In fact, it did nothing. It is as if it doesn't read the $1 as a variable. I commented out the last rm to make sure it didn't do anything and in fact there is not renamer$$ in /var/tmp The script must be ok because there is no error. It just does nothing. if I just enter renamer.sh with no parameters it does nothing. I thoght it should say invalid directory or something. #!/bin/sh cd $1 || echo "No such directory." && exit 1; tf=/tmp/renamer.$$; rm -f $tf; ls *[A-Z]* | awk '{print "mv", $1, tolower($1)}' > $tf; source $tf; rm -f $tf; exit 0; Rejean Proulx Visit my family at http://interfree.ca MSN is: rejp@rogers.com Ham License VA3REJ ----- Original Message ----- From: "Luke Davis" To: Sent: Monday, November 10, 2003 10:27 PM Subject: Re: Mixed Case Directory Names > One of the first things the script does, is to place the name of a file in > the "tf" variable. > That file name is "/tmp/renamer.", followed by the current unique process > ID (a number from 1 to five digits). > > ls *[A-Z]* > > Is a standard ls, with the file spec provided as a (bastardized > (bashtardized?)) regular expression. That regexp says: > > *: zero or more characters of any kind > [: start a character class specification > A-Z: class specification: any characters inclusively between capital A and > capital Z (that is: the entire capitalized alphabet) > ]: Close the class spec > *: any character > > So, ls will only list files that have at least one capital letter in their > names. Otherwise, there would have had to been some error handling which > I did not care to deal with. > > Now, we send the output of that ls, via the pipe character (send to > another program) ("|"), into the awk program, which is a text processor. > That program takes each line of input (a single file name--ls outputs > files one per line when sending to programs), and does the following with > it: > > 1. Outputs the letters "mv". > 2. Outputs a space. > 3. Outputs the first field of the line (the file name). > 4. Outputs a space. > 5A. Runs the "tolower" function, giving it that same first field as the > string to convert to lower case. > 5B. Outputs the result of that function, which is a lower case file name. > > It does that for each line, and sends the output to the file named in the > variable "tf" (see the top of the script). > It then sources that same file from $tf. By sourcing, I mean that it > reads in the contents of that file, and executes them as if they were > originally part of the program. > > There is also some business about deleting $tf if it already exists, and > at the end of the program, changing to the initial directory (and > generating an error if that doesn't work), and so on. > > If you want to see what the sourced file looks like, remove the last "rm" > statement, then read a file in /tmp, called "renamer.". > > HTH > > Luke > > > > > > > On Mon, 10 Nov 2003, Rejean Proulx wrote: > > > Thanks, I trust you, but I'm making a copy of this stuff and then I'll run > > it. Seriously, I wouldn't mind asking you questions about this script. I > > know that you are storing an ls of the files. but I'm not quite sure how > > the rest of the thing works. > > _______________________________________________ > Speakup mailing list > Speakup@braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup