X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <4F6FBC46.30707@tlinx.org> Date: Sun, 25 Mar 2012 17:45:58 -0700 From: Linda Walsh User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: John Fairhall , "cygwin AT cygwin DOT com" Subject: Re: cygwin bash include scripting and error code return question References: <3B35330F74CE0544934D0AAC1FBF7AFD019D01 AT AMSPRD0702MB120 DOT eurprd07 DOT prod DOT outlook DOT com> In-Reply-To: <3B35330F74CE0544934D0AAC1FBF7AFD019D01@AMSPRD0702MB120.eurprd07.prod.outlook.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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