This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Checking XCOPY Exit Value in Cygwin Bash
- From: "Mark Fisher" <mark dot j dot fisher at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Sun, 6 Aug 2006 17:47:15 +0100
- Subject: Re: Checking XCOPY Exit Value in Cygwin Bash
- References: <74382BAFEAA.000000D2wolfpack@inbox.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/