delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/06/17:38:22

X-Spam-Check-By: sourceware.org
Message-ID: <44D66132.6040903@inbox.com>
Date: Mon, 07 Aug 2006 06:37:54 +0900
From: Shane <wolfpack AT inbox DOT com>
User-Agent: Thunderbird 1.5.0.5 (Windows/20060719)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Checking XCOPY Exit Value in Cygwin Bash
References: <44D62FDA DOT 4010303 AT inbox DOT com> <Pine DOT GSO DOT 4 DOT 63 DOT 0608061623080 DOT 3283 AT access1 DOT cims DOT nyu DOT edu>
In-Reply-To: <Pine.GSO.4.63.0608061623080.3283@access1.cims.nyu.edu>
X-IWM-ACU: KHYcJ46lPVU9E7Hxlx4rPegFoOUzDsZKTxd2wUc_72N459Dfd9CYA142ks2c Fj-GbkAyv0XajsJJYt2RdqWC_MQxY924fnSy5SGu8LuwygTRJ1nCBKh21QcC vzw@@
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k76Lc8Jw032093

Igor Peshansky wrote:
> As David said, cvs has an easy way of doing this (using "cvs diff" and
> "patch"), which will also deal with local and checked in changes to the
> same file (while your method won't).
>
>   
Point taken. I will certainly look into it.
> Did you happen to notice the mention of the "--keep-newer-files" tar
> option in my original reply to you?  Just add that to the last "tar", and
> you will only copy the files that were changed in your copy (presumably by
> you) after the checked in version.
>
>   
Yeah I saw that reply and I had tried it. There were two problems.
    1. New files will not be added to the build directory. It will say 
something like
          tar: ./Test/res/Test.manifest: Warning: Cannot stat: No such 
file or directory
          tar: Current `./Test/res/Test.manifest' is newer
       and the required manifest file is not copied into the build 
folder. So for the initial copy I have to
       use it without the --keep-newer-files, and for the subsequent 
copies I will have to use the --keep-newer-files.

    2. This is the real problem. That is getting an indication whether 
none of the files were updated or not. I want to             proceed 
with the rest of the building script only if more than one files have 
been copied. I do not know how to             get that using the tar 
command. I tried echoing the $? value but it gives 0 all the time. The 
source compiler can
         detect if the sources were updated or not, on it's own, but 
there are a lot of projects in one Visual Studio
         Solution (about 60), that I can't wait until all those projects 
have been parsed.
        I am using                  
                                while read amount ; do

         		if [ ${amount::1} != "0" ]; then
             			copied=true;
         		fi
     		done < copy.log
	for that purpose.

> MSDN apparently lies.  XCOPY for me returns non-zero on error, and 0 on
> normal execution (no matter how many files were copied).
>   
If that is the case, then there is no point in trying to check for the 
xcopy return value.
As a short term solution I will stick with my original XCOPY solution. 
But I will try to find out
what CVS, Make and the other tools have to offer. If there is a way of 
getting if files have been replaced using the
tar command, I will try to implement that into my solution.
Although I am fairly competent at programming in C/C++, this is my first 
attempt in writing a serious bash script,
and I must admit that I am both impressed and overwhelmed by it's power. :)

Thank you all for the help offered so far.
Regards
Shane

____________________________________________________________
GET FREE 5GB ONLINE STORAGE - Safely store your documents, photos and music online!
Visit http://www.inbox.com/storage to find out more!

--
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/


- Raw text -


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