getopt example in docs incorrectly implies /bin/sh may not be used (PATCH)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
util-linux (Ubuntu) |
Confirmed
|
Low
|
Unassigned |
Bug Description
getopt(1) works with /bin/sh, bash, and probably other Bourne-ish shells (as well as csh-family shells with the appropriate option).
However the included examples give the impression that something about getopt(1) makes it incompatible with /bin/sh, leading one to assume that scripts MUST use bash instead of sh. The author probably meant merely that the "bash" example would not work with tcsh; however less-experienced script writers might not find that to be obvious.
First of all, the Bourne-syntax example unnecessarily uses bash, i.e. leading one to wonder why the more-universal sh shell could not be used. And there is a comment in the example saying "This program will only work with bash(1)".
SUGGESTED IMPROVEMENT (patch attached):
. Rename /usr/share/
. Change the example to use /bin/sh instead of bash, and change the comment to say that that example works only with sh-compatible shells, including bash.
P.S. The --shell option to getopt(1) accepts arguments 'sh', 'bash', 'csh', and 'tcsh', however internally there is no difference between 'sh' and 'bash' (or between 'csh' and 'tcsh'). See source code at https:/
ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: util-linux 2.20.1-5.1ubuntu9
ProcVersionSign
Uname: Linux 3.11.0-20-generic x86_64
NonfreeKernelMo
ApportVersion: 2.12.5-0ubuntu2.2
Architecture: amd64
Date: Wed May 14 21:00:48 2014
InstallationDate: Installed on 2013-08-06 (282 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
MarkForUpload: True
SourcePackage: util-linux
UpgradeStatus: Upgraded to saucy on 2013-10-24 (202 days ago)
Changed in util-linux (Ubuntu): | |
importance: | Undecided → Low |
Status changed to 'Confirmed' because the bug affects multiple users.