This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sftp progress showing ... 66% complete


Robert Body wrote:

> ok it appears my problem is with my script, not sftp:
> 
> specifically with using tee or > in the command: (time $mycommand) 2>&1 |
> tee $tempFile

The sftp program, like many others (e.g. scp) will only output status
information if stdout is a tty.  When you redirect to a file this is not
the case.  The reason it does this is that interactive progress meters
like those used by most file transfer programs will look like gibberish
when redirected to a file, because they usually print repeated status
update lines every few seconds, using carriage returns to overwrite the
prior output without advancing a row on the screen.

You can get around this by using something like the 'script' utility,
which will provide a pseudoterminal (pty) to the program so that it
thinks it's being run interactively, but the output in fact goes to a
file.  However if you look at this output with something like 'less' it
will probably look like garbage because of all these repeated lines. 
Again, these programs are not intended to log their interactive outputs
to a file, so if you do this you will probably have to process the
output in some way if you want something readable.  However, if you
simply 'cat' the output to a terminal it will look perfectly normal
since in effect you are just playing back all these terminal sequences
in fast-forward.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]