bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getopts broken on second execution


From: Chet Ramey
Subject: Re: getopts broken on second execution
Date: Mon, 27 Dec 2004 17:16:23 -0500

> if I run getopts for the second time it ignores all its arguments.
> No matter how $OPTIND is set. It worked fine in bash2, it is broken in bash3.
> 
> Is there a bug in the attached code or in bash?

You need to reset OPTIND to 1 before you use getopts a second time, no
matter whether or not you declare it as local in the function.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]