View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0001951 | 1003.1(2024)/Issue8 | Shell and Utilities | public | 2025-10-25 21:48 | 2025-10-30 16:58 | 
| Reporter | Love4Boobies | Assigned To | |||
| Priority | normal | Severity | Editorial | Type | Error | 
| Status | New | Resolution | Open | ||
| Name | Bogdan Barbu | ||||
| Organization | |||||
| User Reference | |||||
| Section | getopts, EXAMPLES section | ||||
| Page Number | https://pubs.opengroup.org/onlinepubs/9799919799/utilities/getopts.html | ||||
| Line Number | Idk, I used the web version | ||||
| Interp Status | |||||
| Final Accepted Text | |||||
| Summary | 0001951: getopts example oversight | ||||
| Description | The example snippet handles ? instead of \?. It still works but only by accident (the ? wildcard still matches the literal question mark returned by getopts) because no other options are handled after it. | ||||
| Desired Action | Change ? to \? | ||||
| Tags | No tags attached. | ||||
|  | It seems likely to me that not escaping the ? is intentional.  In a script with a large number of options, if there is a mismatch between the list passed to getopts and the list handled in the case statement, it is desirable for an unexpected value of "name" to be reported as a usage error rather than falling through the case statement unhandled. My suggestion is to change the ? to * so that it is clear this is a catch-all (even though it should always be one character). | 
| Date Modified | Username | Field | Change | 
|---|---|---|---|
| 2025-10-25 21:48 | Love4Boobies | New Issue | |
| 2025-10-30 16:58 | geoffclare | Note Added: 0007301 | 
