simple question about mv
Andrew Koenig
ark at alice.UUCP
Sat Jan 28 08:01:46 AEST 1989
In article <18216 at adm.BRL.MIL>, DEG41560 at ua1vm.ua.edu (Rob Smith) writes:
> I know this is simple, but then again, so am I. What if I want to mv a bunch
> of files with the same suffix to another suffix. The following does not
> work
>
> mv *.flip *.flop
If you give a bunch of operands to mv, the last one must be a directory
and all the others are moved into that directory. Thus the last
(in alphabetical order) thing with a name of *.flop becomes the
target directory and everything else winds up thee.
This is almost surely not what you want.
To get what you want, try this:
for i in *.flip
do mv $i `echo $i | sed 's/flip$/flop/'`
done
--
--Andrew Koenig
ark at europa.att.com
More information about the Comp.unix.questions
mailing list