This is the mail archive of the
mailing list for the Cygwin project.
Re: sftp progress showing ... 66% complete
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Sat, 10 Dec 2005 13:29:36 -0800
- Subject: Re: sftp progress showing ... 66% complete
- References: <BAY104-F32CB9ECD2D331C88D8A7ACAD440@phx.gbl>
- Reply-to: 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 firstname.lastname@example.org < 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 email@example.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.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html