Neil Parker wrote:

Patrick 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?

Forget IFS--xargs can do you work for you, and in just one command line:

    xargs -i scp '[EMAIL PROTECTED]:{}' here/ <list-of-files

(where "list-of-files" is your file containing the list of filenames).

              - Neil Parker
Neil Parker
I was able to get satisfactory results from this one by added \" in four places (see below) - granted my testing was all local. Does it behave differently when copying from remote?
Regards
Fred James

#! /bin/sh
#       fubar3.sh
#
fileName="fubar"
xargs -i scp \"'{}'\" \"'{}'\".new < $fileName
exit

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

Reply via email to