Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Using variables in command substitution
- X-seq: zsh-users 15121
- From: "Dan Luther" <dan@xxxxxxxxxxxxxx>
- To: "'Peter Stephenson'" <Peter.Stephenson@xxxxxxx>
- Subject: RE: Using variables in command substitution
- Date: Mon, 14 Jun 2010 09:58:33 -0500
- Cc: <zsh-users@xxxxxxx>
- In-reply-to: <20100614100244.04f82d61@xxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <001201cb0b89$63e2e3b0$2ba8ab10$@net> <20100614100244.04f82d61@xxxxxxx>
- Sender: "Dan Luther" <dan@xxxxxxxxxxxxxx>
- Thread-index: AcsLoHSni6u+tRxDTrKJ42i4tWnUdgAMUC6g
Thanks -- this fixed my problem. You have to escape the "|" character, e.g.:
HNAME=(uname -n \| cut -d. -f1)
. . .
Thank you again for prompt reply!
-----Original Message-----
From: Peter Stephenson [mailto:Peter.Stephenson@xxxxxxx]
Sent: Monday, June 14, 2010 4:03 AM
To: Dan Luther
Cc: zsh-users@xxxxxxx
Subject: Re: Using variables in command substitution
On Mon, 14 Jun 2010 01:18:13 -0500
"Dan Luther" <dan@xxxxxxxxxxxxxx> wrote:
> I'm trying to unify my .zshrc across a couple of platforms, and I ran
> across an interesting ZSH behavior. Essentially, I want to assign a
> variable to the name of a specific command for later substitution:
You're hitting the fact that zsh doesn't split scalar variables
automatically. See http://zsh.sourceforge.net/FAQ/zshfaq03.html#l18 .
A quick fix for the commands is to use arrays:
ME=(/usr/xpg4/bin/id -un)
etc.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ,
UK
Member of the CSR plc group of companies. CSR plc registered in England and
Wales, registered number 4187346, registered office Churchill House,
Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.829 / Virus Database: 271.1.1/2934 - Release Date: 06/13/10
14:45:00
Messages sorted by:
Reverse Date,
Date,
Thread,
Author