Patrick R. Wade wrote:

My problem ; i have a file containing a list of filenames, which may contain spaces or dots in them:
---
foo
bar baz
quux.random
---
I would like to execute a series of scp commands on them:
---
scp [EMAIL PROTECTED]:foo here/
scp "[EMAIL PROTECTED]:bar baz" here/
scp [EMAIL PROTECTED]:quux.random here/
---
My various efforts at IFS definition have not done what i wanted.
Can anyone point me towards the right way to do this?

Thanks for your time...

Patrick R. Wade
Would something like this help?
Regards
Fred James

#! /bin/bash
#       fubar.sh
#       to preform scp commands on the files listed in fubar
#
OrigFile="fubar"
TempFile="Fubar"
cp /dev/null $TempFile
while read fileName
do
       echo $fileName | awk '{
               N = split($0, FUBAR, " ")
               for (i = 1; i <= N; i++) {
                       if (i == 1) {
                               Name = FUBAR[i]
                       } else {
                               Name = Name "\\ " FUBAR[i]
                       }
               }
               printf ( "scp \"%s\" \"%s.new\"\n", Name, Name )
       }' >> $TempFile
done < $OrigFile
sh $TempFile
exit


_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to