X-Spam-Check-By: sourceware.org Message-ID: <439B48C0.38DC82CC@dessent.net> Date: Sat, 10 Dec 2005 13:29:36 -0800 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: sftp progress showing ... 66% complete References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Robert Body wrote: > 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. Okay, it makes a lot more sense what you are trying to do now. There are several much better ways (IMHO) to do this. Firstly, if you use /bin/time instead of the shell builtin 'time' command, you can specify both a format and an output file: /bin/time -f "%e seconds elapsed" -o /tmp/timelog \ sftp who AT where DOT com < fileWithActions What you're doing now ends up calling perl three times. If you're going to use perl you might as well just call perl once and do everything there, since it is far more powerful than screwing around with head/tail/expr/etc (which are very inefficient ways to process text since you fork/exec a process for each operation): perl -e 'use Time::HiRes qw(time); $start = time; system("sftp who AT where DOT com < fileWithActions"); printf "%.2f seconds elapsed\n", time - $start;' This allows for any kind of formatting of the output you desire, as well as better-than-second granularity. 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/