Re: oddities in /sbin/service

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2006-11-18 at 06:50 -0800, oldman wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Robert P. J. Day wrote:
> >   as part of a crash course in teaching some folks scripting this last
> > week, i grabbed a random FC6 script and walked through it with them.
> > i chose /sbin/service since it's a nice example of several scripting
> > features in a single place, but that script does have some strange
> > code in it.
> > 
> >   first, as an exercise for the reader, what is so amusing about
> > *this* snippet of script:
> > 
> > 
> >     case "${1}" in
> >       --help | -h | --h* )
> > 
> > 
> >   also, based on the structure of the main argument processing loop,
> > you can invoke service in some weird ways:
> > 
> >   $ service httpd --version
> >   service ver. 0.91
> > 
> > where you can see that the first argument of service name "httpd" is
> > superseded by "--version".  is that by design?  just curious.
> > 
> > rday
> > 
> 	I read here recently that (I believe) bash reads the input line and
> ensures that switches (i.e. --<something> or -*) is associated with the
> command (always the first thing in a command line). I'll assume that it
> also fixes entries with pipes or ; in a similar way.
> 
> 	I think you'll find that most other commands work this way such as "yum
> - -y update --exclude=<something> gtk2 --enablerepo=<whatever>" will work
> no matter what order you put the switches or command arguments.
> 
I am pretty sure that I have tried this and the order of arguments make
a difference. Foe example, the --exclude argument must come before the
update argument. That is certainly implied by the output of man yum.
> 	That same email suggested that the behavior is due to change due to
> posix. I'm not sure what posix has to do with this, but apparently
> eventually you will need to use the command line in the form of <cmd>
> <switches> <arguments>.  This is o.k. with me as it is the way I've
> always done it.
> 
> Scott
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
> 
> iD8DBQFFXx2l5mBKdb7VQEcRAihaAJ0WEaMFahajOqY4RcdDU2L/2zq8pQCgiNH6
> dK0d+uCIonHDK4Qr4PwHHME=
> =arEd
> -----END PGP SIGNATURE-----
> 
--
=======================================================================
If someone had told me I would be Pope one day, I would have studied
harder. -- Pope John Paul I
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam@xxxxxxxxxxxxx


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux