public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: James Chargin <jimccrown@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] HUSH logical AND/OR expressions
Date: Tue, 28 Apr 2015 11:19:07 -0700	[thread overview]
Message-ID: <553FCF1B.4010308@gmail.com> (raw)
In-Reply-To: <CANr=Z=ah8pBB-QzmwEi9ds1tNoqzYKy51AecjxTJ-Q3MSeERFA@mail.gmail.com>

Dear Joe Hershberger,
On 04/28/2015 11:00 AM, Joe Hershberger wrote:
> Hi Joakim,
>
> On Mon, Apr 27, 2015 at 8:39 AM, Joakim Tjernlund
> <joakim.tjernlund@transmode.se> wrote:
>> Trying to get a better handle of HUSH shell expressions, this does not work as I expect:
>> => false && true || echo ECHO
>> => false && false || echo ECHO
>>
>> none prints ECHO, seems like a bug?
>
> I think it works as it should. false followed by && will terminate always.
>
>> This the only one that prints ECHO
>>> = true && false || echo ECHO
>
> This also seems correct. Passing true into && and false into || will
> always continue.
>

I thought hush is supposed to be mostly similar to sh. On my Linux 
desktop, bash (which is supposed to be backward compatible with sh) says

$ which sh
/usr/bin/sh
$ ls -l /usr/bin/sh
lrwxrwxrwx 1 root root 4 Apr 17 14:43 /usr/bin/sh -> bash
$ sh --version
GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ sh
sh-4.2$ false && true || echo ECHO
ECHO
sh-4.2$ false && false || echo ECHO
ECHO
sh-4.2$ true && false || echo ECHO
ECHO
sh-4.2$ exit
exit

Is this one of the places where hush and sh are not the same?

Regards,
Jim
-- 
Jim Chargin
AJA Video Systems                       jimc at aja.com
(530) 271-3334                          http://www.aja.com

  reply	other threads:[~2015-04-28 18:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 13:39 [U-Boot] HUSH logical AND/OR expressions Joakim Tjernlund
2015-04-28 18:00 ` Joe Hershberger
2015-04-28 18:19   ` James Chargin [this message]
2015-04-28 18:35     ` Joe Hershberger
2015-04-28 19:13       ` James Chargin
2015-04-28 19:47         ` Joe Hershberger
2015-04-28 22:51           ` Wolfgang Denk
2015-04-29 15:19             ` James Chargin

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=553FCF1B.4010308@gmail.com \
    --to=jimccrown@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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