[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scp from stdin



Carel Fellinger wrote:
> On Tue, Nov 28, 2000 at 04:10:17PM -0600, Brian McGroarty wrote:
>> Is there a way to pipe input to a file on a remote host via scp?
>> 
>> i.e.
>> 
>> tar cz ~user | scp ??? user@remotehost.com:outfile.tgz
> 
> I think not directly, but you could try:
> 
> $ tar cz ~user | ssh user@remotehost.com 'umask 077 && cat >outfile.tgz'
> 
> ofcourse umask is futile if the file allready exists:(

Well, try tempfile:

$ tar cz ~user | ssh user@remotehost.com \
    'umask 077 && OUT=$(tempfile -d ~/ -p out -s .tgz) && cat >$OUT'
-- 
Justin B Rye - writing from but not for Datacash Ltd



Reply to: