delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
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 |
Message-ID: | <419B89EE.2080208@4js.com> |
Date: | Wed, 17 Nov 2004 18:27:10 +0100 |
From: | Geoffrey KRETZ <gk AT 4js DOT com> |
User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: long command executed via a variable fails |
References: | <419B70A9 DOT 6020203 AT 4js DOT com> <419B769E DOT 4060905 AT x-ray DOT at> |
In-Reply-To: | <419B769E.4060905@x-ray.at> |
X-IsSubscribed: | yes |
Reini Urban wrote: > Geoffrey KRETZ schrieb: > >> I've got a problem with a shell script used with Cygwin 1.5.10-3 on >> W2000 SP4 and W XP SP 2. >> >> The following part of code works on all the Unix I've tested >> (HP-UX/AIX/Sun Solaris/Linux). >> >> With Cygwin, it doesn't :( >> >> >> *Code:* >> >> cmd="long shell command with differents parameters" >> if [ ! eval $cmd ]; then >> echo "Error : $cmd" >> exit 1 >> fi >> >> >> >> instead of eval $cmd, i've tried : >> - `eval $cmd` >> - eval `$cmd` >> - $cmd >> - `$cmd` >> >> I've also try with a function without more success. >> >> *Code:* >> >> execCmd() >> { >> eval $cmd >> return $? >> } >> >> cmd="long shell command with differents parameters" >> if [ ! execCmd ]; then >> echo "Error : $cmd" >> exit 1 >> fi >> >> >> >> The only way I've find is : >> >> *Code:* >> >> cmd="long shell command with differents parameters" >> eval $cmd >> if [ $? -ne 0 ]; then >> echo "Error : $cmd" >> exit 1 >> fi >> >> Is it possible to make it work like the two first exemple or I'm >> obliged to use the third solution ? > > > FAQ: http://cygwin.com/faq/faq_3.html#SEC43 > cygwin's /bin/sh is ash, on most other platforms it is /bin/bash. > > If you want it to behave it exactly like on other platforms, and you use > bash specific constructs, use the /bin/bash shebang. > If I specified "#! /bin/bash" at the first line of my shell script, is it enough to make Cygwin understand that I want to use bash instead of ash ?? -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |