Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Message-ID: <419B70A9.6020203@4js.com> Date: Wed, 17 Nov 2004 16:39:21 +0100 From: Geoffrey KRETZ 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: long command executed via a variable fails Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Hello, 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 ? Thanks in advance, Geoffrey -- 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/