mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] doc: add note about characters like hyphens in variable names
Date: Tue, 10 Nov 2020 16:34:29 +0100	[thread overview]
Message-ID: <20201110153430.32123-1-a.fatoum@pengutronix.de> (raw)

The mismatch between the allowed characters in shell variables and
device parameters is a common pitfall, especially because device
tree node names often have hyphens in them, which is disallowed by
hush.

While such variables can be read by the ${variable-example}, setting
them is only possible with the setenv command. Reflect this in the
documentation.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Cc: Matthias Fend <Matthias.Fend@wolfvision.net>
---
 Documentation/user/driver-model.rst | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/user/driver-model.rst b/Documentation/user/driver-model.rst
index a0fd3e99b55b..c543d6d9c410 100644
--- a/Documentation/user/driver-model.rst
+++ b/Documentation/user/driver-model.rst
@@ -88,7 +88,14 @@ The parameters can be used as shell variables:
 .. code-block:: sh
 
   eth0.ipaddr=192.168.23.15
-  echo "my current ip is: $eth0.ipaddr"
+  echo "my current ip is: ${eth0.ipaddr}"
+
+.. note::
+
+  Hush shell syntax for defining and setting variables is the same, so
+  some characters such as hyphens are not allowed on the left hand side
+  of a shell variable assignment. :ref:`command_setenv`, if enabled,
+  can still be used to write such a variable though.
 
 device variables may have a type, so assigning wrong values may fail:
 
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2020-11-10 15:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 15:34 Ahmad Fatoum [this message]
2020-11-10 15:34 ` [PATCH 2/2] Documentation: state: clarify how to access state device parameters Ahmad Fatoum
2020-11-13  7:53 ` [PATCH 1/2] doc: add note about characters like hyphens in variable names Sascha Hauer

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=20201110153430.32123-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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