Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: pop - is there a more elegant solution



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