On Wed, Jul 03, 2013 at 03:30:33PM +0200, Natanael Copa wrote:
> On Mon, 1 Jul 2013 17:14:16 -0400> Dubiousjim <dubiousjim@gmail.com> wrote:> > -while getopts "alih" opt ; do> > - case "$opt" in> > - a) aflag="-a" ;;> > - i) iflag="-i" ;;> > - l) lflag="-l" ;;> > - h|*) usage;;> > - esac > > +args=`getopt -o ailh --long all,initd,list,help -n "$PROGRAM" -- "$@"`> > I don't think this is posix shell compatible.> > We already use various extensions like 'local' and shell replace> expansion ${var/search/replace} so we already depend on an extended shell.> > I think this is ok for now, but we should be aware of that this is> moving away from posix shell compat.> > Is long options worth it?
I've got a bunch of patches for the abuild package too that I'm cleaning up,
including long options for many of the small scripts.
I'm pretty sure you're right that POSIX doesn't require any getopt shell
command or utility. So this is extra-POSIX. BusyBox (as we configure it)
provides getopt as an external utility, so in our case we do go beyond
Posix but we're not thereby requiring an extra-POSIX *shell*.
Perhaps Bash implements getopt as an internal shell command, I don't
remember.
> I also made a posix shell implementation for parsing options for lxc> templates which we could use instead.
Where is that?
--
Dubiousjim
dubiousjim@gmail.com
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
On Wed, 3 Jul 2013 10:09:10 -0400
Dubiousjim <dubiousjim@gmail.com> wrote:
...
> I've got a bunch of patches for the abuild package too that I'm cleaning up,> including long options for many of the small scripts.> > I'm pretty sure you're right that POSIX doesn't require any getopt shell> command or utility. So this is extra-POSIX. BusyBox (as we configure it)> provides getopt as an external utility, so in our case we do go beyond> Posix but we're not thereby requiring an extra-POSIX *shell*.
hm 'getops' is in posix.
> Perhaps Bash implements getopt as an internal shell command, I don't> remember.
I think we can use getopt with long opts. it will save us for some work.
> > I also made a posix shell implementation for parsing options for lxc> > templates which we could use instead.> > Where is that?https://github.com/lxc/lxc/commit/e60a8164c12d565f70071ff6b32b823dd495df9e
Basically all the src/lxc/*.in scripts in there.
-nc
PS. I'm really happy for your review of the code, questioning the old
code and patches for improvements. Thanks!
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---