From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1067 invoked by alias); 14 Jun 2010 06:48:57 -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: 15119 Received: (qmail 29811 invoked from network); 14 Jun 2010 06:48:53 -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=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at eigbox.net designates 66.96.184.19 as permitted sender) X-EN-OrigOutIP: 10.20.18.7 X-EN-IMPSID: ViJR1e004099BUA01iJRLb From: "Dan Luther" To: Subject: Using variables in command substitution Date: Mon, 14 Jun 2010 01:18:13 -0500 Message-ID: <001201cb0b89$63e2e3b0$2ba8ab10$@net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0013_01CB0B5F.7B0CDBB0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcsLiV6MqgMgfv6OR4Sfd97S4jioTg== Content-Language: en-us X-EN-UserInfo: 2dff425fffc153c1d61e4aff1ab5a5c9:a0a1756f2a50e17c16dccfa3fe4abe21 X-EN-AuthUser: dan@theluthers.net Sender: "Dan Luther" X-EN-OrigIP: 70.234.129.116 X-EN-OrigHost: adsl-70-234-129-116.dsl.tul2ok.sbcglobal.net ------=_NextPart_000_0013_01CB0B5F.7B0CDBB0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello, I'm hoping someone can explain this. 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: if [$(uname)="SunOS"]; then ME="/usr/xpg4/bin/id -un" elif [$(uname)="Linux"]; then ME="id -un" else ME="who am i | cut -d ' ' -f1" fi HNAME=$(uname -n | cut -d. -f1) . . . cd() { chdir "$@"; prompt="[$($ME)@$HNAME] $(pwd)> "; } . . . When I try to use the "cd" redefinition, I get: .zshrc: no such file or directory /usr/xpg4/bin/id -un Is it possible to use variables in command expansion at all, or am I just doing it wrong? Thank you for your time. ------=_NextPart_000_0013_01CB0B5F.7B0CDBB0--