delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/03/15:43:08

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 3 Jan 2005 15:42:49 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Kenneth Stephen <marvin DOT the DOT cynical DOT robot AT gmail DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: [pdksh]getopts problem in conjunction with shift
In-Reply-To: <808d4e7c050102215047f81fb4@mail.gmail.com>
Message-ID: <Pine.GSO.4.61.0501031533370.2820@slinky.cs.nyu.edu>
References: <808d4e7c050102215047f81fb4 AT mail DOT gmail DOT com>
MIME-Version: 1.0

On Sun, 2 Jan 2005, Kenneth Stephen wrote:

> Hi,
>
>     I have the following script (a.ksh) :
>
> $ cat a.ksh
> #!/usr/bin/ksh -x
>
> echo $*
> getopts abc var
>
> echo $?
> echo $var
> echo $OPTIND
> echo $OPTARG
>
> shift
>
> echo $*
> getopts abc var
>
> echo $?
> echo $var
> echo $OPTIND
> echo $OPTARG
>
>     When run on AIX ksh, it produces the following (expected output) :
>
> $ ./a.ksh -a something
> + echo -a something
> -a something
> + getopts abc var
> + echo 0
> 0
> + echo a
> a
> + echo 2
> 2
> + echo
>
> + shift
> + echo something
> something
> + getopts abc var
> + echo 1
> 1
> + echo ?
> ?
> + echo 2
> 2
> + echo
>
>     On Cygwin (pdksh 5.2.14-3), it produces :
>
> bash-2.05b$ ./a.ksh -a something
> + echo -a something
> -a something
> + getopts abc var
> + echo 0
> 0
> + echo a
> a
> + echo 2
> 2
> + echo
>
> + shift
> + echo something
> something
> + getopts abc var
> ./a.ksh[14]: -m: unknown option
> + echo 0
> 0
> + echo ?
> ?
> + echo 2
> 2
> + echo
>
>     Why is it dying like this?

This seems to be PDksh-specific, but not Cygwin-specific, behavior -- it
does the same for me on Linux.  Feel free to report it to the upstream
maintainer (see <http://web.cs.mun.ca/~michael/pdksh/> for bug reporting
instructions).  Thanks for the report, I'll also investigate as time
permits.

Igor Pechtchanski, the Cygwin PDksh maintainer
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019