zsh-users
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: sergio <mailbox@sergio.spb.ru>
Cc: zsh-users@zsh.org
Subject: Re: dumb question about parameter expansion
Date: Thu, 11 Oct 2012 14:20:35 +0200	[thread overview]
Message-ID: <87zk3tgpyk.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <5076B49A.90101@sergio.spb.ru> (sergio's message of "Thu, 11 Oct 2012 15:59:22 +0400")

sergio wrote:
> Looks like it's dumb question, but I can't understand this.
>
> % zsh -f
> % l='ls'
> % o='-l -h'
> % $l $o
> ls: invalid option -- ' '
> Try `ls --help' for more information.
>
> % ls -l -h
> total 512
> drwxr-x---  2 sergio sergio ...

Zsh doesn't do wordsplitting of unquoted parameters (at least not by
default, which is a good thing[tm]). Use an array instead:

% o=(-l -h)
% ls $o

See <http://zshwiki.org/home/scripting/paramexp> as well.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


      parent reply	other threads:[~2012-10-11 12:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 11:59 sergio
2012-10-11 12:19 ` Jérémie Roquet
2012-10-11 12:20 ` Frank Terbeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zk3tgpyk.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=mailbox@sergio.spb.ru \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).