Hello,

i have a simple shell script problem. if i have a file name with a space in
the name the following script doesn't get the entire name. The for loop
conditional statement below stops for spaces or new lines... i would like it
to stop for just new lines. is there a way to do that with shell script. how
can i change the condition in the for loop to do that?

Thanks,
brian

input.txt
--------
Tom Petty - Free Fallin'.mp3
Dave Matthews.mp3


size.sh
-------
#!/bin/sh -x
# sh size.sh /smb/dc input.txt

PATH=$1
INPUT=$2

for i in `/bin/cat ${INPUT}`; do
    echo "in loop"
    FILE=`echo $i | /usr/bin/awk -F: '{ print $1 }'`
    SIZE=`echo $i | /usr/bin/awk -F: '{ print $2 }'`

    echo "${FILE}
done
exit 0;


current result
-------------
Tom
Petty
-
Free
Fallin'.mp3
Dave
Matthews.mp3


desired result
--------------
Tom Petty - Free Fallin'.mp3
Dave Matthews.mp3

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to