How to capture error in Cygwin, $? is not working
nlian
norliansyah@gmail.com
Thu Mar 13 06:10:00 GMT 2008
Hi,
I want to write a simple script to start and stop windows service remotely.
Here is the script:
#!/usr/bin/bash
sc \\\\servername start "MyService"
echo $?
=======
The above script return the following messages:
[SC] StartService: OpenService FAILED 1060:
The specified service does not exist as an installed service.
0
=======
What I don't understand is why $? return 0 and not 1060 or any other
error code. I want to capture the error code returned from windows program
How to do this in Cygwin? Please advise.
Thanks.
--
View this message in context: http://www.nabble.com/How-to-capture-error-in-Cygwin%2C-%24--is-not-working-tp16021741p16021741.html
Sent from the Cygwin list mailing list archive at Nabble.com.
--
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