From: Andrew Ruder <andy@aeruder.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_nvedit.c: Add env exists command
Date: Wed, 23 Oct 2013 09:30:58 -0500 [thread overview]
Message-ID: <20131023143058.GA9685@gmail.com> (raw)
In-Reply-To: <5267D536.2020605@gmail.com>
On Wed, Oct 23, 2013 at 06:55:02AM -0700, James Chargin wrote:
> I have, more recently, been using scripting of the form
>
> if test "X" != "X${var}"; then
> echo defined
> else
> echo undefined
> fi
Thanks for the feedback.
I was attempting to do something like that originally but was hitting
problems related to the expansion which I'm still tracking down:
WRONG:
$ set var
$ test "x${var}" = "x" && echo undefined
undefined
$ set var 1
$ test "x${var}" = "x" && echo undefined
$ set var "1; 2; 3"
$ test "x${var}" = "x" && echo undefined
>> undefined
It DOES seem to work a lot better with != as you mentioned above
though...
RIGHT:
$ set var
$ test "x${var}" != "x" && echo defined
$ set var 1
$ test "x${var}" != "x" && echo defined
defined
$ set var "1; 2; 3"
$ test "x${var}" != "x" && echo defined
defined
- Andy
next prev parent reply other threads:[~2013-10-23 14:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 0:07 [U-Boot] [PATCH] cmd_nvedit.c: Add env exists command Andrew Ruder
2013-10-23 13:55 ` James Chargin
2013-10-23 14:30 ` Andrew Ruder [this message]
2013-11-08 22:29 ` [U-Boot] " Tom Rini
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=20131023143058.GA9685@gmail.com \
--to=andy@aeruder.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.