Re: [Linuxcommand-discuss] Greetings & a Script
Brought to you by:
bshotts
|
From: Alaa T. G. <al...@an...> - 2002-08-29 00:58:29
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
- --
Perilous to all of us are the devices of an art deeper than we
ourselves
possess.
-- Gandalf the Grey [J.R.R. Tolkien, "Lord of the
Rings"]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
iD8DBQE9bXCQqIWBQ7ecPHcRAudiAJ9v0GMzAtqk5BqpGYcBEtU/VUh9bwCghC+M
xIYgdHy/0trhSLFzqc/8zag=
=aHkG
-----END PGP SIGNATURE-----
|