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: Checking XCOPY Exit Value in Cygwin Bash


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/


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