Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Word splitting in parameter expansion
- X-seq: zsh-users 6064
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Word splitting in parameter expansion
- Date: Fri, 02 May 2003 16:56:32 +0100
- In-reply-to: "Björn Lindström"'s message of "Fri, 02 May 2003 17:45:56 +0200." <20030502154556.GA29562@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
=?iso-8859-1?Q?Bj=F6rn_Lindstr=F6m?= wrote:
> I've got this in my .zshrc:
>
> man() {
> screen -h 0 -t "man $@" man $@
> }
>
> This works fine as long as I only supply the function with one argument,
> such as "man access", but when I do "man 5 access", it interprets
> "5 access" as one argument (even though that is not what I meant ;-).
I don't think it's doing quite what you say (although you don't see what
options you have set), but I agree it won't do what you expect...
If the arguments are `5' and `access' I would expect the words to be
divided as:
screen
-h
0
-t
man 5
access
man
5
access
(which is certainly what I get with my option settings). The problem is
that the argument to -t is being divided into two parts. To prevent that
you need:
man() {
screen -h 0 -t "man $*" man $@
}
Actually, that last argument could be $* as well; if you want to
maintain zero-length arguments it needs to be "$@".
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author