From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24661 invoked by alias); 5 Apr 2011 09:02:33 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15937 Received: (qmail 21732 invoked from network); 5 Apr 2011 09:02:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) MIME-Version: 1.0 In-Reply-To: <110404072617.ZM9904@torch.brasslantern.com> References: <110404072617.ZM9904@torch.brasslantern.com> Date: Tue, 5 Apr 2011 01:31:25 -0700 Message-ID: Subject: Re: is variable with variable name possible? From: Bart Schaefer To: Zsh Users Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The reply quoted below got hung up on my server for several hours because a CentOS upgrade clobbered my sendmail configuration, which I didn't notice immediately. Restored from backup (which is why I'm up at 1:30am) and it finally went out. In the interim the discussion has pointed out an omission I made. On Mon, Apr 4, 2011 at 7:26 AM, Bart Schaefer w= rote: > > You can also use ${somevar::=3D$(pwd)} anywhere that you'd reference the > value of $somevar, including the no-op command: > > =A0 =A0: ${somevar::=3D$(pwd)} > > =A0 =A0: ${(As:/:)somevar::=3D$(pwd)} The bit I forgot is that to get the effect desired in the original message, you must add the (P) flag to each of the above, as in: : ${(P)somevar::=3D$(pwd)} : ${(PAs:/:)somevar::=3D$(pwd)} As long as I'm expostulating I'll add that "somevar" can even be a positional parameter, both with and without the (P) flag. E.g. : ${(As:/:)1::=3D$(pwd)} will splice the current directory hierarchy into the front of "$@".