Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: pop - is there a more elegant solution
- X-seq: zsh-users 3967
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: pop - is there a more elegant solution
- Date: Thu, 28 Jun 2001 10:04:15 +0200 (MET DST)
- In-reply-to: <200106280801.KAA63855@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
jarausch@xxxxxxxxxxxxxxxxxxxxxxxxxxx@igpm.rwth-aachen.de wrote:
> Hello,
>
> just being curious,
> is there a more elegant (less cryptic) solution to
>
> #!/bin/zsh
> # get the last parameter and shorten the list
> # emulate Perl's pop function
> echo $@
> last=$[-1]
> # shorten the parameter array
> set $@[0,$[-1+$#]]
> echo $@
>
> Thanks for your opinion,
Not much less cryptic:
last="$argv[-1]"
argv[-1]=()
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author