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: cygwin bash include scripting and error code return question


John Fairhall wrote:

Hi,

I have a cygwin bash script running on 32 bit XP.

I have a windows BAT script calling bash, like so:

-------------------
bash mainScript.sh 2>&1 | tee %LOGFILE%
bash mailBuild.sh %ERRORLEVEL% %LOGFILE%
-------------------


What I was hoping was that bash would propagate the shell script's return code to the external OS, but as far as I can see the windows ERRORLEVEL is always 0.


Is there a way to make bash do this?

----
Question -- is %ERRORLEVEL% returning the value of bash or the value of 'tee'? I am guessing it returns the value of 'tee'.


If you want to do what you are doing...um...

bash -o pipefail -c "mainScript.sh >| tee %LOGFILE%"



should do it...

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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