Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
>
> -----------------------------------------------------------
> #!/usr/bin/bash1 -f
> while read file; do
> mv "$file" "`echo $file | awk -F: '{print $NF}'`"
> done < ../songlist
> -----------------------------------------------------------
Okay, I can't resist - the construct you were looking for was:
for file in *; do
mv "$file" "`echo $file | awk -F: '{print $NF}'`"
done
That doesn't have the problem of breaking up the filenames on spaces. I
can explain if you really want ... it's to do with which program sees the
arguments and the order they are processed in.
As for the rm problem, with removing a file called '-' or even worse '-f'
or -whatever ... Mike mentioned filenames with some of these characters:
!, ' ', $, *, - all the shell special characters. Dealing with those is
simply a matter of using the correct quoting (which can get very
convoluted) but the shell passes on the dash as is. It is rm seeing the
dash as an option that causes problems. To get around this you can call
it with:
rm [options] -- [filenames]
The '--' causes rm to stop processing options and treat everything else
as a filename.
Cheers, Rob
--
To manage your subscription, go to http://mlug.missouri.edu/members/edit.php
Archives are available at http://mlug.missouri.edu/list-archives/