Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Advanced Bash Shell Scripting Gude.pdf
Скачиваний:
57
Добавлен:
17.08.2013
Размер:
4.82 Mб
Скачать

Miscellany

 

Advanced Bash-Scripting Guide:

Prev

Next

Chapter 34. Miscellany

Nobody really knows what the Bourne shell's grammar is. Even examination of the source code is little help.

Tom Duff

Table of Contents

34.1.Interactive and non-interactive shells and scripts

34.2.Shell Wrappers

34.3.Tests and Comparisons: Alternatives

34.4.Optimizations

34.5.Assorted Tips

34.6.Oddities

34.7.Security Issues

34.8.Portability Issues

34.9.Shell Scripting Under Windows

Prev

Home

Next

Unofficial Shell Scripting

Up

Interactive and non-

Stylesheet

 

interactive shells and scripts

http://tldp.org/LDP/abs/html/miscellany.html [7/15/2002 6:34:41 PM]

Author's Note

 

Advanced Bash-Scripting Guide:

 

Prev

Chapter 36. Endnotes

Next

36.1. Author's Note

How did I come to write a Bash scripting book? It's a strange tale. It seems that a couple of years back, I needed to learn shell scripting -- and what better way to do that than to read a good book on the subject? I was looking to buy a tutorial and reference covering all aspects of the subject. I was looking for a book that would take difficult concepts, turn them inside out, and explain them in excruciating detail with well-commented examples. [1] In fact, I was looking for this very book, or something much like it. Unfortunately, it didn't exist, and if I wanted it, I'd have to write it. And so, here we are, folks.

This reminds me of the apocryphal story about the mad professor. Crazy as a loon, the fellow was. At the sight of a book, any book -- at the library, at a bookstore, anywhere -- he would become totally obsessed with the idea that he could have written it, should have written it, and done a better job of it to boot. He would thereupon rush home and proceed to do just that, write a book with the very same title. When he died some years later, he allegedly had several thousand books to his credit, probably putting even Asimov to shame. The books might not have been any good, who knows, but does that really matter? Here's a fellow who lived his dream, even if he was obsessed by it, driven by it, and I can't help admiring the old coot...

Notes

[1] This is the notorious "flog it to death" technique.

Prev

Home

Next

Endnotes

Up

About the Author

http://tldp.org/LDP/abs/html/authorsnote.html [7/15/2002 6:34:42 PM]

About the Author

 

Advanced Bash-Scripting Guide:

 

Prev

Chapter 36. Endnotes

Next

36.2. About the Author

Who is this guy anyhow?

The author claims no credentials or special qualifications, other than a compulsion to write. [1] This book is somewhat of a departure from his other major work, HOW-2 Meet Women: The Shy Man's Guide to Relationships. He has also written the Software-Building HOWTO.

A Linux user since 1995 (Slackware 2.2, kernel 1.2.1), the author has emitted a few software truffles, including the cruft one-time pad encryption utility, the mcalc mortgage calculator, the judge Scrabble® adjudicator, and the yawl word gaming list package. He got his start in programming using FORTRAN IV on a CDC 3800, but is not the least bit nostalgic for those days.

Living in a secluded desert community with wife and dog, he cherishes human frailty.

Notes

[1] Those who can, do. Those who can't... get an MCSE.

Prev

Home

Next

Author's Note

Up

Tools Used to Produce This

 

 

Book

http://tldp.org/LDP/abs/html/aboutauthor.html [7/15/2002 6:34:42 PM]

Tools Used to Produce This Book

 

Advanced Bash-Scripting Guide:

 

Prev

Chapter 36. Endnotes

Next

36.3. Tools Used to Produce This Book

36.3.1. Hardware

A used IBM Thinkpad, model 760XL laptop (P166, 104 meg RAM) running Red Hat 7.1/7.3. Sure, it's slow and has a funky keyboard, but it beats the heck out of a No. 2 pencil and a Big Chief tablet.

36.3.2. Software and Printware

i.Bram Moolenaar's powerful SGML-aware vim text editor.

ii.OpenJade, a DSSSL rendering engine for converting SGML documents into other formats.

iii.Norman Walsh's DSSSL stylesheets.

iv.DocBook, The Definitive Guide, by Norman Walsh and Leonard Muellner (O'Reilly, ISBN 1-56592-580-7). This is the standard reference for anyone attempting to write a document in Docbook SGML format.

Prev

Home

Next

About the Author

Up

Credits

http://tldp.org/LDP/abs/html/toolsused.html [7/15/2002 6:34:43 PM]

Credits

 

Advanced Bash-Scripting Guide:

 

Prev

Chapter 36. Endnotes

Next

36.4. Credits

Community participation made this project possible. The author gratefully acknowledges that writing this book would have been an impossible task without help and feedback from all you people out there.

Philippe Martin translated this document into DocBook/SGML. While not on the job at a small French company as a software developer, he enjoys working on GNU/Linux documentation and software, reading literature, playing music, and for his peace of mind making merry with friends. You may run across him somewhere in France or in the Basque Country, or email him at feloy@free.fr.

Philippe Martin also pointed out that positional parameters past $9 are possible using {bracket} notation, see Example 5-5.

Stephane Chazelas sent a long list of corrections, additions, and example scripts. More than a contributor, he has, in effect, taken on the role of editor for this document. Merci beaucoup!

I would like to especially thank Patrick Callahan, Mike Novak, and Pal Domokos for catching bugs, pointing out ambiguities, and for suggesting clarifications and changes. Their lively discussion of shell scripting and general documentation issues inspired me to try to make this document more readable.

I'm grateful to Jim Van Zandt for pointing out errors and omissions in version 0.2 of this document. He also contributed an instructive example script.

Many thanks to Jordi Sanfeliu for giving permission to use his fine tree script (Example A- 17).

Likewise, thanks to Michel Charpentier for permission to use his dc factoring script (Example 12-36).

http://tldp.org/LDP/abs/html/credits.html (1 of 3) [7/15/2002 6:34:43 PM]

Credits

Kudos to Noah Friedman for permission to use his string function script (Example A-18).

Emmanuel Rouat suggested corrections and additions on command substitution and aliases. He also contributed a very nice sample .bashrc file (Appendix G).

Heiner Steven kindly gave permission to use his base conversion script, Example 12-33. He also made a number of corrections and many helpful suggestions. Special thanks.

Rick Boivie contributed the delightfully recursive pb.sh script (Example 34-10) and suggested performance improvements for the monthlypmt.sh script (Example 12-32).

Florian Wisser enlightened me on some of the fine points of testing strings (see Example 7- 5), and on other matters.

Oleg Philon sent suggestions concerning cut and pidof.

Marc-Jano Knopp sent corrections on DOS batch files.

Hyun Jin Cha found several typos in the document in the process of doing a Korean translation. Thanks for pointing these out.

Andreas Abraham sent in a long list of typographical errors and other corrections. Special thanks!

Others making helpful suggestions and pointing out errors were Gabor Kiss, Leopold Toetsch, Peter Tillier, Marcus Berglof, Tony Richardson, Nick Drage (script ideas!), Rich Bartell, Jess Thrysoee, Adam Lazur, Bram Moolenaar, Baris Cicek, and David Lawyer (himself an author of 4 HOWTOs).

My gratitude to Chet Ramey and Brian Fox for writing Bash, an elegant and powerful scripting tool.

Very special thanks to the hard-working volunteers at the Linux Documentation Project. The LDP hosts a repository of Linux knowledge and lore, and has, to a large extent, enabled the publication of this book.

Thanks most of all to my wife, Anita, for her encouragement and emotional support.

http://tldp.org/LDP/abs/html/credits.html (2 of 3) [7/15/2002 6:34:43 PM]

Credits

Prev

Home

Next

Tools Used to Produce This

Up

Bibliography

Book

 

 

http://tldp.org/LDP/abs/html/credits.html (3 of 3) [7/15/2002 6:34:43 PM]