zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "Jack McKinney" <jackmc-zsh-users@lorentz.com>, zsh-users@sunsite.auc.dk
Subject: Re: converting parameter to words
Date: Fri, 13 Oct 2000 18:23:23 +0000	[thread overview]
Message-ID: <1001013182323.ZM5486@candle.brasslantern.com> (raw)
In-Reply-To: <20001013104819.A32478@stocks.pillory.com>
In-Reply-To: <gmv3di04sz5.fsf@kempelen.iit.bme.hu>

On Oct 13, 10:48am, Jack McKinney wrote:
}
} for i
} do
}   temp="$temp -r $i"
} done
} 
} command $temp
} 
} From the man page, it sounds like ${^temp} or ${=temp} should
} work, but neither does.

${=temp} should have done it for you:

zagzig[562] x="foo -r bar -r baz"
zagzig[563] print -l ${=x}
foo
-r
bar
-r
baz

However, it would do the wrong thing if any of the original arguments
contained whitespace.

On Oct 13,  6:16pm, Nemeth Ervin wrote:
}
} for i in ...
} do
}   temp=("$temp[@]" -r "$i")
} done
} 
} command "$temp[@]"

This is the right idea.  Unless you have shwordsplit set (which you must
not, or you wouldn't have needed ${=temp} in the first place) you don't
even need the quotes that Nemeth used; and unless you have shortloops
turned off you can just write it like this:

    local temp i
    for i; temp=($temp -r $i)
    command $temp

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2000-10-13 18:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-13 15:48 Jack McKinney
2000-10-13 16:16 ` Nemeth Ervin
2000-10-13 18:23   ` Bart Schaefer [this message]
2000-10-13 20:02     ` Jack McKinney
2000-10-13 19:53   ` Jack McKinney

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=1001013182323.ZM5486@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=jackmc-zsh-users@lorentz.com \
    --cc=zsh-users@sunsite.auc.dk \
    /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).