zsh-users
 help / color / mirror / code / Atom feed
* zparseopts inside functions
@ 2007-01-26 15:55 Meino Christian Cramer
  2007-01-26 16:11 ` Peter Stephenson
       [not found] ` <87y7npn4xz.fsf@lrde.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Meino Christian Cramer @ 2007-01-26 15:55 UTC (permalink / raw)
  To: zsh-users

 Hi,

  I wrote a little testscript:

    #! /bin/zsh
    
    zparseopts s:=svar t:=tvar u:=uvar
    echo $svar
    echo $tvar
    echo $uvar

 which works nice.

 But if I write this instead:

    #! /bin/zsh
    
    function takeargs
    {   
        zparseopts s:=svar t:=tvar u:=uvar
        echo $svar
        echo $tvar
        echo $uvar
    }

    takeargs


 nothing works anymore (the echo put only "\n"'s on my screen...).

 I am sure I missed a very basic simple thing...but unfortunately I
 seem to be "blinded by the screen"...

 Thank you very much in advace!
 Have a nice weekend!
 mcc



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: zparseopts inside functions
  2007-01-26 15:55 zparseopts inside functions Meino Christian Cramer
@ 2007-01-26 16:11 ` Peter Stephenson
       [not found] ` <87y7npn4xz.fsf@lrde.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2007-01-26 16:11 UTC (permalink / raw)
  To: zsh-users

Meino Christian Cramer wrote:
>     function takeargs
>     {   
>         zparseopts s:=svar t:=tvar u:=uvar
>         echo $svar
>         echo $tvar
>         echo $uvar
>     }
> 
>     takeargs

Change the last line to

    takeargs "$@"

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: zparseopts inside functions
       [not found] ` <87y7npn4xz.fsf@lrde.org>
@ 2007-01-26 17:13   ` Meino Christian Cramer
  0 siblings, 0 replies; 3+ messages in thread
From: Meino Christian Cramer @ 2007-01-26 17:13 UTC (permalink / raw)
  To: michael; +Cc: zsh-users

From: michael@cadilhac.name (Michaël Cadilhac)
Subject: Re: zparseopts inside functions
Date: Fri, 26 Jan 2007 17:11:36 +0100

Hi Michael,

 thanks for your reply!

 Yes, it works! :)

 ...but I thought, $ARGV and friends would be global......

 Have a nice weekend!
 mcc


> Meino Christian Cramer <Meino.Cramer@gmx.de> writes:
> 
> >     #! /bin/zsh
> >
> >     function takeargs
> >     {   
> >         zparseopts s:=svar t:=tvar u:=uvar
> >         echo $svar
> >         echo $tvar
> >         echo $uvar
> >     }
> >
> >     takeargs
> >
> >  nothing works anymore (the echo put only "\n"'s on my screen...).
> >
> >  I am sure I missed a very basic simple thing...but unfortunately I
> >  seem to be "blinded by the screen"...
> 
> Maybe... some arguments to takeargs ? :-) Try with
>    takeargs "$@"
> I think.
> 
> -- 
>  |      Michaël `Micha' Cadilhac     |  In a World without Walls and Fences,  |
>  |         Epita/LRDE Promo 2007     |     who needs Windows and Gates?       |
>  |  http://michael.cadilhac.name     |          -- Dino Esposito              |
>  `--JID: michael.cadilhac@gmail.com--'                                   -  --'


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-26 17:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-26 15:55 zparseopts inside functions Meino Christian Cramer
2007-01-26 16:11 ` Peter Stephenson
     [not found] ` <87y7npn4xz.fsf@lrde.org>
2007-01-26 17:13   ` Meino Christian Cramer

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).