From: Frank Wunderlich <frank-w@public-files.de>
To: barebox@lists.infradead.org
Subject: use string as variable name
Date: Sun, 23 Jan 2022 10:58:36 +0100 [thread overview]
Message-ID: <trinity-82a62e55-a3b0-43a3-8656-8a983119c309-1642931916783@3c-app-gmx-bs30> (raw)
Hi,
is it possible to use a string as variable-name?
example:
i=1
img_$i=foo
now i have defined $img_1, but how to display it using $i again?
echo ${img_$i}
echo ${img_${i}}
alternative may be a variable-array, but it seems not possible
img[$i]=bar
img[1]=bar: No such file or directory
i just want to create a dynamic list and access the items of this list by index
another way may be appending new string with separator to existing string and split afterwards,
but then i have the index-problem again.
i know barebox shell is limited (but much more mighty than expected for just a bootloader),
but maybe it is possible :)
any idea?
regards Frank
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2022-01-23 10:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-23 9:58 Frank Wunderlich [this message]
2022-01-25 14:16 ` 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=trinity-82a62e55-a3b0-43a3-8656-8a983119c309-1642931916783@3c-app-gmx-bs30 \
--to=frank-w@public-files.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