Fred JamesTue Nov 15 08:50:47 PST 2005
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 me at there:foo here/ >>scp "me at there:bar baz" here/ >>scp me at there: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 'me at there:{}' 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