Re: [Linuxcommand-discuss] Greetings & a Script
Brought to you by:
bshotts
|
From: William S. <wes...@co...> - 2002-08-29 02:21:50
|
On Wednesday 28 August 2002 08:53 pm, Alaa The Great wrote: > nice script, > I modified it a bit to be handle filenames with spaces (they are not a > good idea I know) > > #!/bin/bash > old=$1 > new=$2 > for i in *$old; > do > echo mv \"$i\" \"`basename "$i" $old`$new\"; > done > > > I prefer it to print the commands on stdout first just to make sure > that everything is OK and then pipe the output to bash for the actual > renaming to happen. > > cheers, > Alaa Yes! That is an excellent technique for testing your work. Everybody should look at this and see how Alaa is using echo to see the command that is created. I do this same trick all the time while I am developing. -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org |