Re: oddities in /sbin/service

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

 



Robert P. J. Day wrote:
>   first, as an exercise for the reader, what is so amusing about
> *this* snippet of script:
> 
> 
>     case "${1}" in
>       --help | -h | --h* )

Jeff Vian wrote:

> As standard syntax for the case statement I don't see anything funny.
> Please enlighten us.

Well, one could argue that the --help was superfluous, given that it
would have been caught by the --h*, but it does help document what the
option *means*.

The "${1}" does make a good example of careful shell programming, how to
handle quotes and spaces, and the fact that if a user quotes a space so
that a longer string will be passed to the script as its first argument,
then the quotes the user provided will be stripped off, and the shell
needs to provide its own quotes if it wants to be sure that the first
argument is, in fact, one argument...

James.

-- 
E-mail:     james@ | "Minis on the other hand are just the wrong size. Too
aprilcottage.co.uk | small to work on directly and too large to put upside
                   | down on the workbench."
                   |     -- stevo at madcelt.org

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux