Pro Bash Programming, Scripting the GNU-Linux Shell, Johnson C., Varma J.

Pro Bash Programming, Scripting the GNU-Linux Shell, Johnson C., Varma J.
 
Фрагмент из книги:
A shell script is a file containing one or more commands that you would type on the command line. This chapter describes how to create such a file and make it executable. It also covers some other issues surrounding shell scripts, including what to name the files, where to put them, and how to run them. I will begin with the first program traditionally demonstrated in every computer language: a program that prints “Hello, World!” in your terminal. It’s a simple program, but it is enough to demonstrate a number of important concepts. The code itself is the simplest part of this chapter. Naming the file and deciding where to put it are not complicated tasks, but they are important.
For most of this chapter, you will be working in a terminal. It could be a virtual terminal, a terminal window, or even a dumb terminal. In your terminal, the shell will immediately execute any commands you type (after you press Enter, of course).

Pro Bash Programming, Scripting the GNU-Linux Shell, Johnson C., Varma J.


Choosing and Using a Text Editor.
For many people, one of the most important pieces of computer software is a word processor. Although I am using one to write this book (LibreOffice Writer), it's not something I use often. The last time I used a word processor was five years ago when I wrote the first edition of this book. A text editor, on the other hand, is an indispensable tool. I use one for writing e-mail, Usenet articles, shell scripts, PostScript programs, web pages, and more.

A text editor operates on plain-text files. It stores only the characters you type; it doesn’t add any hidden formatting codes. If I type A and press Enter in a text editor and save it, the file will contain exactly two characters: A and a newline. A word-processor file containing the same text would be thousands of times larger. (With abiword, the file contains 2,526 bytes; the LibreOffice.org file contains 7,579 bytes.)

You can write scripts in any text editor, from the basic e3 or nano to the full-featured emacs or nedit. The better text editors allow you to have more than one file open at a time. They make editing code easier with, for example, syntax highlighting, automatic indentation, autocompletion, spell checking, macros, search and replace, and undo. Ultimately, which editor you choose is a matter of personal preference. I use GNU emacs (see Figure 1-1).

Оглавление.
About the Authors.
Acknowledgments.
Chapter 1: Hello, World: Your First Shell Program.
Chapter 2: Input, Output, and Throughput.
Chapter 3: Looping and Branching.
Chapter 4: Command-Line Parsing and Expansion.
Chapter 5: Parameters and Variables.
Chapter 6: Shell Functions.
Chapter 7: String Manipulation.
Chapter 8: File Operations and Commands.
Chapter 9: Reserved Words and Built-In Commands.
Chapter 10: Writing Bug-Free Scripts and Debugging the Rest.
Chapter 11: Programming for the Command Line.
Chapter 12: Runtime Configuration.
Chapter 13: Data Processing.
Chapter 14: Scripting the Screen.
Chapter 15: Entry-Level Programming.
Appendix A: Shell Variables.
Index.



Бесплатно скачать электронную книгу в удобном формате, смотреть и читать:
Скачать книгу Pro Bash Programming, Scripting the GNU-Linux Shell, Johnson C., Varma J. - fileskachat.com, быстрое и бесплатное скачивание.

Скачать pdf
Ниже можно купить эту книгу по лучшей цене со скидкой с доставкой по всей России.Купить эту книгу



Скачать - pdf - Яндекс.Диск.
Дата публикации:





Хештеги: :: :: ::


Следующие учебники и книги:
Предыдущие статьи: