consider the following directory:

        % ls
        A 1st file  A 3rd file  A 5th file  A 7th file
        A 2nd file  A 4th file  A 6th file

i don't understand what's going on here; spaces in the filename seem to
delineate the end of the file, according to the following script.  i trust
echo.  the problem must be `ls`.

        % for i in `ls`; do echo $i; done
        A
        1st
        file
        A
        2nd
        file
        A
        3rd
        ...  (etc)


why do i care?  what i would like to do is something along the lines of
(untested):

        for from in `ls`; do
                to=`echo ${from} | sed 's/^\(.*\).mp3$/\1 \(Phish\).mp3/g'`
                move ${from} ${to}
        done


but this isn't going to work if each ${to} is only a portion of a filename.
the spaces in the filename seem to be tripping this script up.  how do i do
something like
        % for i in `ls`; do echo $i; done
and keep files with spaces in the name "in one piece"?

i know better ways of doing this, but would like to understand what's going
on here.

thanks!
pete

Reply via email to