Bug 162007
Summary: | ksh-93 doesn't support + command line options | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Ian Mortimer <i.mortimer> |
Component: | ksh | Assignee: | Karsten Hopp <karsten> |
Status: | CLOSED NOTABUG | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 4 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2005-06-30 13:30:11 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Ian Mortimer
2005-06-29 01:45:46 UTC
ksh's man page doesn't cover everything, please use getopts own man page: ksh> getopts --?? You'll find this section: If the leading character of optstring is +, then arguments beginning with + will also be considered options. A leading : character or a : following a leading + in optstring affects the way errors are handled. If you rewrite your testcase as while getopts +:n opt do case $opt in n) print "-n selected";; +n) print "+n selected";; esac done shift $(($OPTIND-1)) print "arguments: $*" everything works as expected. Thanks for the quick solution. That works and is portable (although not mentioned in the man pages for pdksh and other ksh implementations). However it still breaks backward and cross-platform compatibility since the syntax without the leading + works with other ksh implementations (including pdksh). |