Checking XCOPY Exit Value in Cygwin Bash

Mark Fisher mark.j.fisher@gmail.com
Sun Aug 6 16:47:00 GMT 2006


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/


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /