delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/02/02/11:46:21

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <AANLkTimr-ofHogw+VRXw+fM58wgfyAB1M31HJh1u-PjQ@mail.gmail.com>
References: <AANLkTik3fYVoeP97HrDwP8h3-jBbAr4qmco7EasOTECg AT mail DOT gmail DOT com> <AANLkTimr-ofHogw+VRXw+fM58wgfyAB1M31HJh1u-PjQ AT mail DOT gmail DOT com>
Date: Wed, 2 Feb 2011 10:46:08 -0600
Message-ID: <AANLkTiksXEW-=G8D+4Vie1Z6paxLgLQY8mnDYxNZrZpB@mail.gmail.com>
Subject: Re: 1.7.7: window cuts off output / saving output
From: Rance Hall <ranceh AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Wed, Feb 2, 2011 at 10:13 AM, Rachel Trent <retrent AT ncsu DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019