[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: colon not placed in NAME when required argument is not found
From: |
Chet Ramey |
Subject: |
Re: colon not placed in NAME when required argument is not found |
Date: |
Thu, 01 May 2003 10:16:08 -0400 |
> > If a required argument is not found, and `getopts' is not silent,
> a question mark (`?') is placed in NAME, `OPTARG' is unset, and a
> diagnostic message is printed. If `getopts' is silent, then a
> colon (`:') is placed in NAME and `OPTARG' is set to the option
> character found.
>
> This does not appear to be true in GNU bash, version 2.05b.0(1)-release.
It is, in fact, what happens.
> ? )
> echo "illegal option=$OPTARG";;
You have to remember that these are shell patterns. The `?' matches any
single character, including the `:'.
If you use `\?' instead, things work as you expect.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Chet Ramey, ITS, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: colon not placed in NAME when required argument is not found,
Chet Ramey <=