From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18458 invoked by alias); 8 Dec 2012 15:09:26 -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: 17465 Received: (qmail 3777 invoked from network); 8 Dec 2012 15:09:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at schrab.com designates 50.116.43.67 as permitted sender) Date: Sat, 8 Dec 2012 10:09:11 -0500 From: Aaron Schrab To: shawn wilson Cc: Zsh Users Subject: Re: script help Message-ID: <20121208150911.GA15808@pug.qqx.org> Mail-Followup-To: shawn wilson , Zsh Users References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21+94 (gef61dc7) (2012-12-07) At 06:15 -0500 08 Dec 2012, shawn wilson wrote: >this is in my .zshrc file and it fails to execute $cmd with: >vim:45: no such file or directory: /usr/local/bin/vim --servername >SWILSON Normally zsh doesn't split the result of variable expansion into separate words. You can enable that for your function by adding the following line to it: setopt local_options sh_word_split Enabling the local_options option will cause other options set within the function to be returned to their original state when the function returns. The sh_word_split option will cause the results of expanding your $cmd variable to be split into words before evaluating that line, allowing it to be used as you intended. Another option would be to use ${=cmd} in place of just $cmd when you attempt to run that command. That will cause word splitting to be done in that case only.