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: 1.7.7: window cuts off output / saving output


On Wed, Feb 2, 2011 at 10:13 AM, Rachel Trent <retrent@ncsu.edu> wrote:
<snip>
>
> Long version:
> Within a larger script, I copied over a thousand files from one server
> to another using the following command:
> cp -R -n -p -v "$package" "$destination" | tee -a "$destination"/copiedfiles.txt
>
> However, several files failed to copy due to permissions issues/etc,
> and the copiedfiles.txt file does not include the error information.
> The onscreen output does include this information (due to using the -v
> verbose option), however I can only scroll up to see about 300 lines
> of information (surprise! I wasn't expecting this). My question is:
> can I somehow access the output that was cut off?
>

I don't happen to think that "tee" is the right tool here.

The standard way to do this and record the error messages is with redirection.

In standard linux the screen output is from the stdout device and the
error message is printed to the stderr device with a standard screen
setup both stdout and stderr are the screen, but when you are
recording data to a log file for historical needs, you have to
redirect stderr to stdout so that the tee command can actually see it.

add a 2>&1 to the cp command at the end before the pipe, and tee will
get the errors as well.

BTW this is generically true for all POSIX compatible screen based tools.

Rance

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


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