Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lew Pitcher Newsgroups: comp.unix.shell Subject: Re: create variables in a loop? Date: Wed, 29 May 2024 12:10:32 -0000 (UTC) Organization: A noiseless patient Spider Lines: 35 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 29 May 2024 14:10:32 +0200 (CEST) Injection-Info: dont-email.me; posting-host="addc4a28d9fbe809e2a38ec28a140433"; logging-data="1190022"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18upN/4kpABAjw50onYyspSwdtYdB5FNjc=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:1TxMBExEtL4YTDDvhq9NoQUTLnY= Bytes: 1531 On Wed, 29 May 2024 12:57:06 +0200, Dr Eberhard W Lisse wrote: > Hi, > > I would like to do something like > > for i in USD GBP > do > $i=somevalue > done > > does not work, of course. > > Any idea on how to create (and fill variables through a loop)? echo $CAD $EUR for i in CAD EUR do eval "$i=someval" done echo $CAD $EUR The /eval/ operation is one of those "special built-in utilities that POSIX mandates all POSIX shells must support > > greetings, el -- Lew Pitcher "In Skills We Trust"