X-Spam-Check-By: sourceware.org Message-ID: X-Sender: rbody99 AT hotmail DOT com In-Reply-To: <439AA0FE.3DF2DD69@dessent.net> From: "Robert Body" To: cygwin AT cygwin DOT com Subject: Re: sftp progress showing ... 66% complete Date: Sat, 10 Dec 2005 14:01:56 -0700 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Thanks for the input, Brian, I was trying to have the script re-direct output to a file (well actually just the final command of _time_ command was what mattered), but I guess that meant the sftp progress % went to a file too, but strange thing is, the other Stdout messages like "Uploading..." and "chdir" went to screen normally. So I got rid of of my 2>&1 and tee in my 3 files deep script call, and I did this: start=`perl -e "print time;"` $mycommand end=`perl -e "print time;"` perl -e "\$alpha=($end-$start); print \$alpha.\"s\";" > $tempFileTime # end time - start time I don't know how to handle X-Y in shell itself (nor how to get clock-ticks since 1970/1/1), so i just send it to Perl and have it get clock-ticks at start, at the end and I get the difference, and that's like the output from _time_ (measuring how long $mycommand took) and this way by including "progress" in the input file to sftp i get to see the progress %percentage during transfer :-) -Robert >From: Brian Dessent >Reply-To: cygwin AT cygwin DOT com >To: cygwin AT cygwin DOT com >Subject: Re: sftp progress showing ... 66% complete >Date: Sat, 10 Dec 2005 01:33:50 -0800 > >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/ > -- 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/