bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: important bug


From: PePa
Subject: Re: important bug
Date: Thu, 29 Mar 2018 07:26:41 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

I didn't understand clearly what you were expecting until I actually ran
your example. I think this shows your expectations more clearly:

test a = a && {
  echo this line should be displayed
  test a = b && {
    echo this line should not be displayed and is not
  }
  # echo uncomment this line and the last echo will not display
} || {
  echo this line should never be displayed but is
}

The "test a = b" evaluates to false, which makes the whole enclosure
after "test a = a" also false, and now the last echo will display. The
uncommented echo will make the middle clause true again, causing the
last echo to not display (as expected).

Peter


Klaus Bartels <address@hidden>

On 03/29/2018 01:22 AM, Klaus Bartels wrote:
> If you execute the following script the result is wrong. It is self
> explaining:
> -------------------------------
> #
> # GNU bash, version 4.4.12(1)-release (x86_64-slackware-linux-gnu)
> # Linux ... 4.9.31 #1 SMP Wed Jun 7 14:57:36 CDT 2017 x86_64 Intel(R)
> Core(TM) i5-7400 CPU @ 3.00GHz GenuineIntel GNU/Linux
> #
> test a = a && {
>   echo this line should be displayed
>   test a = b && {
>     echo this line should also not displayed, but creates the error
>     }
>     # echo uncomment this line and all works fine again
>   } || {
>   echo this line should never be displayed
>   }
> #
> ------------------------------
> If you uncomment the line in the middle, the script works correct.
> I hope, it helps
> 
> 
> 
> Mit freundlichen Gruessen  /  Best regards
> Klaus Bartels
> 
> ///---------------------------------------------------------///
> ///      Bartels EDV (Bartels Consulting)                   ///
> ///      Klaus Bartels                                      ///
> ///      Am Bullerbach 11   Phone +49-5484/93 91 0          ///
> ///      D-49536 Lienen     FAX   +49-5484/93 91 16         ///
> ///      Germany            e-Mail address@hidden ///
> ///---------------------------------------------------------///
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]