From owner-freebsd-questions@FreeBSD.ORG Wed Jul 1 18:04:55 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 108D51065670 for ; Wed, 1 Jul 2009 18:04:55 +0000 (UTC) (envelope-from nullpt@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 9B82E8FC1B for ; Wed, 1 Jul 2009 18:04:54 +0000 (UTC) (envelope-from nullpt@gmail.com) Received: by fxm18 with SMTP id 18so916880fxm.43 for ; Wed, 01 Jul 2009 11:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=O+dXkkkdZa1DxHSFl857+JgqIP9fbQyB1hS0gOwvE8E=; b=x7HswYFG4cUei7XkieKwcqv+N5KnZ3XfxV3Dt7AfM/IfVbPckwaBvmYg+JRH0Vo6i4 ZQ7NV3L5TmSVe1Ws6ui6Q7hSSr5BwLsz7UYHbQpMN4oYeX5YnPY6t9GGHvWbvKW9K5w1 IUrgWTkuq4RedoPg6XqpyDPlIkw9JapDumUh8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=q1Qljy0o/W8488qgW69LgHe/P+jzmWg7V95pcap4Jvb/RRQCmBg8YUv6mUi+AcjKe/ lBz0xGgkdnCkpgY1qdS//qtvtSkPmlsbVw37U31QyiX9NK+e/uy+2yE8yUs3Z6FY68cw KS/cqfsBFyNV2vzwc2+JSLYQdOqS5gd++Ifvg= MIME-Version: 1.0 Received: by 10.223.107.199 with SMTP id c7mr6448957fap.31.1246470000738; Wed, 01 Jul 2009 10:40:00 -0700 (PDT) Date: Wed, 1 Jul 2009 18:40:00 +0100 Message-ID: <755cb9fc0907011040o28b82cdbjd5760b139f797050@mail.gmail.com> From: Alexandre Vieira To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: scripting tip needed X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2009 18:04:55 -0000 Hi folks, I'm having a little problem. For exambe in ksh: $ z=0 $ y=1 $ x=aaaa $ eval `echo MACHINE_DISK$z[$y]`=$x $ echo ${MACHINE_DISK0[1]} aaaa My problem is getting back the value of the variable using variables to refer to the variable name (confusing). I.e $MACHINE_DISK$z[$y] . Using ${} works great when you only have a simple array but adding a variable in the middle of the variable name seems to ruin it. $ echo ${MACHINE_DISK0[$y]} aaaa $ echo ${MACHINE_DISK$z[$y]} ksh: ${MACHINE_DISK$z[$y]}: bad substitution Thanks in advance for any tip Cheers