Catálogo de publicaciones - libros

Compartir en
redes sociales


Shell Scripting Recipes: A Problem-Solution Approach

Chris F. A. Johnson

Resumen/Descripción – provisto por la editorial

No disponible.

Palabras clave – provistas por la editorial

Software Engineering/Programming and Operating Systems

Disponibilidad
Institución detectada Año de publicación Navegá Descargá Solicitá
No detectada 2005 SpringerLink

Información

Tipo de recurso:

libros

ISBN impreso

978-1-59059-471-1

ISBN electrónico

978-1-4302-0024-6

Editor responsable

Springer Nature

País de edición

Reino Unido

Fecha de publicación

Información sobre derechos de publicación

© Apress 2005

Tabla de contenidos

PostScript: More Than an Afterthought

Chris F. A. Johnson

The scripts in this chapter produce bare-bones PostScript programs. They do not contain all the Document Structuring Conventions expected by some PostScript interpreters, but are complete enough for Ghostscript and interpreters in PostScript printers. They are not designed to handle much beyond the standard 7-bit ASCII character set, but can be modified to do so.

Besides these scripts, I have scripts for printing chess positions, both single diagrams (usually for conversion to a PNG image) and sheets of several diagrams each, for distribution to my chess students. More often, I write PostScript programs with a text editor, and have a Ghostview window open to display the result and update it whenever I save the file.

Pp. 229-249

Screenplay: The screen—funcs Library

Chris F. A. Johnson

Unlike most functions in this book, those presented in this chapter have little application at the command line; they are designed almost exclusively for use in other scripts. They are useful in interactive scripts such as games or data entry forms. They can be used for presentations (put a series of “slides” in a bash array, and move through them, forward or backward, with a keypress) or menus. They are not as fancy as GUI applications, but can be used to create impressive displays in very little time.

Pp. 251-277

Backing Up the Drive

Chris F. A. Johnson

A Multimedia communication system for blind users is developed. The system is named MIMIZU and its terminal is composed of a refreshable tactile graphic display and a stylus pen device that utilizes ultrasonic technologies. Blind users can make drawings directly on the tactile display surface with the stylus pen. It was originally developed as a drawing system with an erasing function. As the research progresses, we have noticed that it has a potential as a communication system for the blind with multimedia interactions. To implement the system, we made a pair of terminals and connected them by a network cable and developed communication software for a whiteboard application. Using the system, a pair of blind users can make and share tactile image information with each other. We describe results of a simple experiment in which one subject tried to transmit simple drawings to the other subject using this system. The tactile display’s resolution presented the difficulty in transmitting a circle, but the results were useful when transmitting shapes based on straight lines. Even when the subject is a circle, it is recognized when prior information is available. In addition to the communication software, we developed a type of ping-pong game for the system. The ball is shown by four pins arranged in a square and it moves from side to side. To play the game, players must hit the ball with a racket controlled by the stylus pen. The experiment with blind players showed that they could enjoy this game.

Pp. 279-292

Aging, Archiving, and Deleting Files

Chris F. A. Johnson

The scripts in this chapter are the building blocks of a file-aging system. While these commands can be used manually, their value increases when they are combined in a script tailored to your needs.

Pp. 293-302

Covering All Your Databases

Chris F. A. Johnson

Besides presenting one complete, though simple, application (PhoneBase), the functions I have provided here are the building blocks for serious database manipulation. The demonstration script can easily become the basis for a general-purpose database viewer and entry program that accepts command line arguments for the file and the delimiter.

Pp. 303-321

Home on the Web

Chris F. A. Johnson

A single chapter can hardly do justice to the possibilities of using shell scripts in conjunction with HTML files. Nevertheless, there is a good deal to chew on in this chapter, and the tools presented lay the groundwork for more advanced scripts.

Pp. 323-344

Taking Care of Business

Chris F. A. Johnson

My bookkeeping needs are small, and the general ledger system described in this chapter is simple for both data entry and reporting. The latter is often done with a one-off script that I discard. If I need to expand the database, adding more fields means less than a dozen lines of additional code.

Both scripts will run in any POSIX shell, but they are enhanced when interpreted by bash2+.

Pp. 345-360

Random Acts of Scripting

Chris F. A. Johnson

The mathematical literature contains a wealth of information and discussion on random numbers. Much of it explains why this method or that method is not good enough to generate truly random numbers. Some papers reject pseudo-random number generators altogether; others allow that they have their uses.

For practical purposes, however, PRNGs are adequate in the majority of cases, and certainly for anything one is likely to do in a shell script. The scripts in this chapter presented methods of generating and manipulating random numbers as well as some applications for them.

They will serve you well for day-to-day use, but please don’t use them for encrypting national secrets!

Pp. 361-379

A Smorgasbord of Scripts

Chris F. A. Johnson

The scripts in this chapter are generally less polished than in the rest of the book, and some work in limited environments. More than in other chapters, the code here is often more interesting than the script itself. All the scripts do solve a problem expressed by someone at one time or another, but some are included mostly because the techniques used can be applied to solving other problems.

Pp. 381-395

Script Development Management

Chris F. A. Johnson

There’s not a great deal to my system for managing script development, but it is enough to save a lot of work and worry. The most important part of it is cpsh, which takes care of installing and backing up my scripts. But isn’t something missing? For a long time I thought so: Where is the script to revert the installed copy to an earlier version?

For a long time I planned to write the reversh script, but finally came to the conclusion that it really wasn’t necessary. Being able to run the development version means that a bad script hardly ever gets installed. I’ve only had to use the backups two or three times in the years I’ve used this system.

Pp. 397-405