X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=CDVkNWY1/8R5af3y s+hqL5+zaeGofvBgAD37LBRsyyrngNqIDugaDJmjlOCNXLcnHj8wv1iiHUutp4xX Ij9ae5GG2OleqbJOs3GoLi6u2o2xlaSbYx4DGUxukEMLXzv7mtxEeUppAUbXmbHH fQ+XwLlUO1EI9p+Zk5uxdMxdgn0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=Mswwfb28l81ah0lZvuuu8R 154yY=; b=wstBfrzSs3nxWDVDGyrt7vpT1h3y0U8w374ZAuwdQM3MogDIB/2B85 5JtXX+17xZl3uiSboK/CC/dSsQwczuD0ke1jkHuo7aZLDKeZC+P3TskE3lZR6nB/ SKlUhZR0NTzz56HsDkiPutP6rD+2nfDR2n4ZV9Ir4JbHk/emQHnVU= 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=H*M:8928, hello!, sell, documents X-HELO: smtp-out-no.shaw.ca X-Authority-Analysis: v=2.2 cv=dZbw5Tfe c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=IkcTkHD0fZMA:10 a=l2Y1mkaQROSDndCZiBoA:9 a=QEXdDO2ut3YA:10 Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: Bug: bash -e misbehaves with several nested To: cygwin AT cygwin DOT com References: <000e01d2d48c$e16d1ca0$a44755e0$@samsung.com> <000e01d2d53d$57318470$05948d50$@samsung.com> <269992253 DOT 20170525174021 AT yandex DOT ru> From: Brian Inglis Message-ID: <8e73e614-f428-8928-4c95-6e1cff393ab5@SystematicSw.ab.ca> Date: Thu, 25 May 2017 11:47:27 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <269992253.20170525174021@yandex.ru> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfLkx0wLn1o2o4bgjib/aI+hxHuOcTZHt+wSD+c7NUqWRECEN0/HTZUbLYRG+BYDO3iRyU7Moi44E6GpRPkaYrhf41cZcxL/dXoKkNB/506nV3re+T19S uoZcR2TmVVtEprYeIzYF1rVKz5ovgRohMbta0KeErHbF1mkShfMZyruh/3Op22ppGHJ5Hnc1FLhvGQ== X-IsSubscribed: yes On 2017-05-25 08:40, Andrey Repin wrote: > Greetings, Pavel Fedin! >>>> Hello! I'd like to report a strange bug in 64-bit bash. The following script: >>>> ---- cut --- >>>> #/bin/bash -e >>>> DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" >>>> echo Works: $DIR >>>> ---- cut --- >>>> Simply exits and produces no output (never reaches echo). The same script works perfectly >>> on 32 bits. Versions are the same: >>>> --- cut --- >>> It works fine for me. >>> $ ./prova.bash >>> Works: /tmp >> Huh, works here too, indeed. But there's one little thing. If you just >> copypasted this from my email, then you probably miss "#!" >> (there's just "#", since i retyped the header, and made a typo). And with >> this typo it really works for some reason. Could you make >> sure once again ? >> Apparently it has to do with -e switch. > I doubt that. >> + cat /home/anrdaemon/Documents/.sh/xx.sh >> #!/bin/bash -xe >> cat "$0" >> DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" >> echo Works: $DIR >> +++ dirname /home/anrdaemon/Documents/.sh/xx.sh >> ++ cd /home/anrdaemon/Documents/.sh >> ++ pwd >> + DIR=/home/anrdaemon/Documents/.sh >> + echo Works: /home/anrdaemon/Documents/.sh >> Works: /home/anrdaemon/Documents/.sh > At the same time, >> #/bin/bash -xe >> cat "$0" >> DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" >> echo Works: $DIR >> /home/anrdaemon/Documents/.sh/xx.sh: 4: >> /home/anrdaemon/Documents/.sh/xx.sh: Bad substitution >> Works: /home/anrdaemon/Documents/.sh > If you are wondering, what's going on, … > sh is not bash. For me. I guess, dash is a little more vocal about > errors, than bash. So the complaint is that sh doesn't work with bash arrays? Hashbangs matter - print that on a T-shirt and sell it ;^> -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada -- 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