Jari Aalto
2005-Aug-08 22:30 UTC
[Logcheck-devel] Bug#322054: Added GNU --long options support (for scripts)
Package: logcheck Version: 1.2.35 Severity: wishlist Add GNU --long option alternatived as well. They are more readable in scripts where cryptic "-s" or "-o" can't be remembered after a month. -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.11-1-686 Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to en_US) Versions of packages logcheck depends on: ii adduser 3.66 Add and remove users and groups ii cron 3.0pl1-87 management of regular background p ii debconf [debconf 1.4.56 Debian configuration management sy ii debianutils 2.14.1 Miscellaneous utilities specific t ii exim4-daemon-hea 4.52-1 exim MTA (v4) daemon with extended ii lockfile-progs 0.1.10 Programs for locking and unlocking ii logcheck-databas 1.2.40 A database of system log rules for ii logtail 1.2.40 Print log file lines that have not ii mailx 1:8.1.2-0.20050715cvs-1 A simple mail user agent ii sysklogd [system 1.4.1-17 System Logging Daemon logcheck recommends no packages.
maximilian attems
2005-Aug-17 21:27 UTC
Bug#322054: [Logcheck-devel] Bug#322054: Added GNU --long options support (for scripts)
On Tue, 09 Aug 2005, Jari Aalto wrote:> Add GNU --long option alternatived as well. They are more readable > in scripts where cryptic "-s" or "-o" can't be remembered after > a month.well the built in bash getopts can't handle long options. that's what logcheck uses. so i guess that bug should be reassigned to bash as wishlist. -- maks
Jari Aalto
2005-Aug-18 14:28 UTC
Bug#322054: [Logcheck-devel] Bug#322054: Added GNU --long options support (for scripts)
| On Tue, 09 Aug 2005, Jari Aalto wrote:
|
| > Add GNU --long option alternatived as well. They are more readable
| > in scripts where cryptic "-s" or "-o" can't be
remembered after
| > a month.
|
| well the built in bash getopts can't handle long options.
| that's what logcheck uses.
| so i guess that bug should be reassigned to bash as wishlist.
Would it be possible to switch to use getopt(1) which is pretty
standard in Linux. An example in bash follows.
Jari
-------
local retval="/tmp/$0.$FUNCNAME.$$"
getopt \
-n $id \
--long
checkout,debug:,Debug:,email:,file:,passphrase:,nomore-space,sign:,release:,Prefix:,sign:,test,verbose,Version,no-strip
\
--option cDd:e:f:mp:Pr:s:tvVx -- "$@" \
> $retval
if [ $? != 0 ] ; then
Exit 1 "$id: Cannot read options."
fi
eval set -- $(< $retval)
while true
do
case $1 in
-c|--checkout)
OPTION_VC_PACKAGE="yes" # global-def
shift 1
;;
-d|--debug)
if [[ "$2" != [0-9] ]]; then
Exit 1 "-- [FATAL] Debug is not numeric; got [$2]"
fi
OPTION_DEBUG=$2 # global-def
shift 2
;;
--) shift
break
;;
-*) Exit 1 "$id: Unknown option [$1]. Aborted."
;;
esac
done