This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Bug: bash -e misbehaves with several nested
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Thu, 25 May 2017 11:47:27 -0600
- Subject: Re: Bug: bash -e misbehaves with several nested
- Authentication-results: sourceware.org; auth=none
- References: <CGME20170524125429eucas1p1384ad5e0c60eb4974a0f57e0f0203d9a@eucas1p1.samsung.com> <000e01d2d48c$e16d1ca0$a44755e0$@samsung.com> <be033564-acfc-1d1a-bc4c-9cbbb73b155f@gmail.com> <000e01d2d53d$57318470$05948d50$@samsung.com> <269992253.20170525174021@yandex.ru>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
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