delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Date: | Mon, 26 Mar 2012 12:26:20 +0200 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: cygwin bash include scripting and error code return question |
Message-ID: | <20120326102620.GN2425@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <3B35330F74CE0544934D0AAC1FBF7AFD019D01 AT AMSPRD0702MB120 DOT eurprd07 DOT prod DOT outlook DOT com> <4F6FBC46 DOT 30707 AT tlinx DOT org> <3B35330F74CE0544934D0AAC1FBF7AFD01A8CB AT AMSPRD0702MB120 DOT eurprd07 DOT prod DOT outlook DOT com> |
MIME-Version: | 1.0 |
In-Reply-To: | <3B35330F74CE0544934D0AAC1FBF7AFD01A8CB@AMSPRD0702MB120.eurprd07.prod.outlook.com> |
User-Agent: | Mutt/1.5.21 (2010-09-15) |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
On Mar 26 05:24, John Fairhall wrote: > The pipe is definitely the problem. > > If I have this: > > bash mainScript.sh 2>&1 > bash mailBuild.sh %ERRORLEVEL% %LOGFILE% > > When I gimmick mainScript to exit with any non-zero value I get an ERRORLEVEL of 255. > > However, when I do this: > > bash -o pipefail mainScript.sh 2>&1 | tee $LOGFILE bash mailBuild.sh %ERRORLEVEL% %LOGFILE% > > I always get a zero ERRORLEVEL. Sure. Consider that the pipe is not created by bash, but by cmd. What you get is the exitcode of the last command in the pipe, which is tee. > When I try this: > > bash -o pipefail -c "mainScript.sh 2>&1 | tee %LOGFILE%" > it errors with > bash: mainScript.sh: command not found Sure. You're using the -c option, so you're trying to run mainScript.sh as a command. I assume mainScript.sh is in the current working directory. And the current working directory is not in $PATH. And it shouldn't. Either use ./mainScript.sh or, better, the full path to mainScript.sh since that makes you independent of your CWD. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |