delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/06/12:47:32

X-Spam-Check-By: sourceware.org
Message-ID: <fb34b27b0608060947k6fc1f4c9n884ee75c1d20929@mail.gmail.com>
Date: Sun, 6 Aug 2006 17:47:15 +0100
From: "Mark Fisher" <mark DOT j DOT fisher AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Checking XCOPY Exit Value in Cygwin Bash
In-Reply-To: <74382BAFEAA.000000D2wolfpack@inbox.com>
MIME-Version: 1.0
References: <74382BAFEAA DOT 000000D2wolfpack AT inbox DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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 8/6/06, Shane wrote:
> Can you please provide me a way of checking the XCOPY exit code: reference [http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true] within Bash?

result codes are stored in $? in bash
success = 0 usually, and xcopy seems to follow the norm here.

here, i did
xcopy somefile somedir
echo $?

which returned 0

when i tried
xcopy nonfile somedir
echo $?

i get 4

so test for 0 for success.

extensions of this idea:
xcopy somefile somedir && echo ok
xcopy somefile somedir || echo fail

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