Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Oct 2005 15:17:17 +0200
From:      Emanuel Strobl <Emanuel.strobl@gmx.net>
To:        freebsd-questions@freebsd.org
Subject:   (bourne)shell variable names containing a variable?
Message-ID:  <200510201517.34489@harrymail>

next in thread | raw e-mail | index | archive | help
--nextPart1362382.qEdR5EDavT
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hello,

I try to assign a value to a variable, but the variable should consist of=20
another variable. Is this possible (in bourne shell)?

Example:

#!/bin/sh
list=3D"one two three four"

for item in $list; do
  ${item}_present=3Dyes
done

This doesn't work since the shell tries to execute "one_present=3Dyes"=20
instead of assigning yes to one_present....

What am I missing????

Thanks a lot,

=2DHarry

--nextPart1362382.qEdR5EDavT
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQBDV5juBylq0S4AzzwRAsA6AJ9HwngSeJzfUDJb3hErHDY+2UjwDQCfTyJu
j1enWqlQygloijWwjx3edEQ=
=UzFQ
-----END PGP SIGNATURE-----

--nextPart1362382.qEdR5EDavT--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510201517.34489>