public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: Bug: bash -e misbehaves with several nested
Date: Thu, 25 May 2017 18:03:00 -0000	[thread overview]
Message-ID: <8e73e614-f428-8928-4c95-6e1cff393ab5@SystematicSw.ab.ca> (raw)
In-Reply-To: <269992253.20170525174021@yandex.ru>

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

  reply	other threads:[~2017-05-25 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170524125429eucas1p1384ad5e0c60eb4974a0f57e0f0203d9a@eucas1p1.samsung.com>
2017-05-24 15:55 ` Pavel Fedin
2017-05-24 19:32   ` Marco Atzeri
2017-05-25 10:31     ` Pavel Fedin
2017-05-25 13:35       ` Marco Atzeri
2017-05-31  9:48         ` Pavel Fedin
2017-05-25 14:54       ` Andrey Repin
2017-05-25 18:03         ` Brian Inglis [this message]
2017-11-10 16:43           ` Pavel Fedin
2017-11-11 18:12             ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e73e614-f428-8928-4c95-6e1cff393ab5@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).