Classic shell scripting

560 971 0
Classic shell scripting

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Đây là bộ sách tiếng anh cho dân công nghệ thông tin chuyên về bảo mật,lập trình.Thích hợp cho những ai đam mê về công nghệ thông tin,tìm hiểu về bảo mật và lập trình.

[...]... combine the Unix tools, together with the standard shell, to get your job done This is the art of shell scripting Shell scripting requires not just a knowledge of the shell language, but also a knowledge of the individual Unix programs: why each one is there, and how to use them by themselves and in combination with the other programs Why should you learn shell scripting? Because often, medium-size to large... haven’t been doing shell scripting for 30 years?!? Well, now that I think about it, I suppose I have, although it was only in a small way at first (The early Unix shells, before the Bourne shell, were very primitive by modern standards, and writing substantial scripts was difficult Fortunately, things quickly got better.) In recent years, the shell has been neglected and underappreciated as a scripting language... of the shell language This chapter looks at shell variables and arithmetic, the important concept of an exit status, and how decision making and loops are done in the shell It rounds off with a discussion of shell functions Chapter 7, Input and Output, Files, and Command Evaluation This chapter completes the description of the shell, focusing on input/output, the various substitutions that the shell. .. performance won’t be a problem Examples of scripting languages include awk, Perl, Python, Ruby, and the shell Because the shell is universal among Unix systems, and because the language is standardized by POSIX, shell scripts can be written once and, if written carefully, used across a range of systems Thus, the reasons to use a shell script are: Simplicity The shell is a high-level language; you can... variances Furthermore, it covers download and build information for ksh and bash It finishes up by discussing shell initialization and termination, which differ among different shell implementations Chapter 15, Secure Shell Scripts: Getting Started In this chapter we provide a cursory introduction to shell scripting security issues Appendix A, Writing Manual Pages This chapter describes how to write a manual... Getting Started This chapter starts off the discussion It begins by describing compiled languages and scripting languages, and the tradeoffs between them Then it moves on, covering the very basics of shell scripting with two simple but useful shell scripts The coverage includes commands, options, arguments, shell variables, xiv | Preface This is the Title of the Book, eMatter Edition Copyright © 2011 O’Reilly... this for compiled programs Our nusers shell script isn’t a compiled program; when the shell asks the kernel to run it, the kernel will fail to do so, returning a “not executable format file” error The shell, upon receiving this error, says “Aha, it’s not a compiled program, it must be a shell script,” and then proceeds to start a new copy of /bin/sh (the standard shell) to run the program The “fall back... /bin/sh” mechanism is great when there’s only one shell However, because current Unix systems have multiple shells, there needs to be a way to tell the Unix kernel which shell to use when running a particular shell script In fact, it helps to have a general mechanism that makes it possible to directly invoke any programming language interpreter, not just a command shell This is done via a special first line... option – says that there are no more shell options; this is a security feature to prevent certain kinds of spoofing attacks 2.5 Basic Shell Constructs In this section we introduce the basic building blocks used in just about all shell scripts You will undoubtedly be familiar with some or all of them from your interactive use of the shell 2.5.1 Commands and Arguments The shell s most basic job is simply... might want The early success of the shell in taking this approach reinforced the developing Unix philosophy of building specialized, single-purpose tools and plugging them together to do the job The philosophy in turn encouraged improvements in the shell to allow doing more jobs that way Shell scripts also have an advantage over C programs—and over some of the other scripting languages too (naming no . with the standard shell, to get your job done. This is the art of shell scripting. Shell scripting requires not just a knowledge of the shell language, but also. Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Classic Shell Scripting,

Ngày đăng: 19/03/2014, 13:32

Từ khóa liên quan

Mục lục

  • Table of Contents

  • Foreword

  • Preface

    • Intended Audience

    • What You Should Already Know

    • Chapter Summary

    • Conventions Used in This Book

    • Code Examples

    • Unix Tools for Windows Systems

      • Cygwin

      • DJGPP

      • MKS Toolkit

      • AT&T UWIN

      • Safari Enabled

      • We’d Like to Hear from You

      • Acknowledgments

      • Chapter 1. Background

        • 1.1 Unix History

        • 1.2 Software Tools Principles

        • 1.3 Summary

        • Chapter 2. Getting Started

          • 2.1 Scripting Languages Versus Compiled Languages

          • 2.2 Why Use a Shell Script?

          • 2.3 A Simple Script

Tài liệu cùng người dùng

Tài liệu liên quan