Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm writing a new backup script in [Powershell][1] to backup our [Azure SQL][2].

After the backup, I need to write into a logfile on a remote linux server.

I thought about using plink (the [putty][3] command line tool). More or less like this:

plink user@server /var/log/logfile<"TEXT"

However, most of you will remark that this isn't possible, and I also learned this :)

Is there no easy way to add a line of text to an existing file on a remote linux system using plink?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

One pretty common method is to use tee. Try one of these.

echo "TEXT" | plink.exe user@server tee /var/log/logfile

type localfile.txt | plink.exe user@server tee /var/log/logfile
share|improve this answer
    
Thx! Actually I should have known this command but I've never used it before. I did only one small change to make it append the text and not overwrite it everytime: echo "TEXT" | plink.exe user@server tee -a /var/log/logfile –  platzhersh Mar 6 '12 at 7:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.