O'Reilly - Learning The Bash Shell.pdf

(955 KB) Pobierz
000
1/338
1
·
¨¨¨¨¨¨¨¨¨
Learning the bash Shell, Second Edition
Publisher: O'Reilly
Pub Date: January 1998
ISBN: 1−56592−347−2
Pages: 334
Ripped by Caudex 2003
This second edition covers all of the features of bash Version 2.0, while still
applying to bash Version 1.x. It includes one−dimensional arrays, parameter
expansion, more pattern−matching operations, new commands, security
improvements, additions to ReadLine, improved configuration and installation,
and an additional programming aid, the bash shell debugger.
1
·
·
·
·
·
·
·
·
·
·
·
·
·
··
·
··
¨¨¨¨¨¨¨¨¨¨
¨¨¨¨¨¨¨¨
¨¨¨¨¨¨
¨¨¨¨¨
¨¨¨¨¨
¨¨¨¨
¨¨¨
¨¨¨¨¨¨¨
¨¨
¨¨¨
¨¨¨¨
¨¨¨¨¨
¨¨¨¨¨¨¨¨¨
¨¨
¨¨
157544722.001.png 157544722.002.png
2/338
1
Copyright © 1998, 1995 O'Reilly & Associates, Inc. All rights reserved.
Printed in the United States of America.
Published by O'Reilly & Associates, Inc., 101 Morris Street, Sebastopol, CA 95472.
The O'Reilly logo is a registered trademark of O'Reilly & Associates, Inc. Many of the designations used by
manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations
appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have
been printed in caps or initial caps. The use of the fish image in association with the bash shell is a trademark
of O'Reilly & Associates, Inc.
While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility
for errors or omissions, or for damages resulting from the use of the information contained herein.
2
3/338
1
Preface
The first thing users of the UNIX or Linux operating systems come face to face with is the shell. "Shell" is the
UNIX term for a user interface to the system—something that lets you communicate with the computer via
the keyboard and the display. Shells are just separate programs that encapsulate the system, and, as such, there
are many to choose from.
Systems are usually set up with a "standard" shell that new users adopt without question. However, some of
these standard shells are rather old and lack many features of the newer shells. This is a shame, because shells
have a large bearing on one's working environment. Since changing shells is as easy as changing hats, there is
no reason not to change to the latest and greatest in shell technology.
Of the many shells to choose from, this book introduces the Bourne Again shell (bash for short), a modern
general−purpose shell. Other useful modern shells are the Korn shell (ksh) and the "Tenex C shell" (tcsh);
both are also the subjects of O'Reilly handbooks.
Preface
3
4/338
1
bash Versions
This book is relevant to all versions of bash, although older versions lack some of the features of the most
recent version. [] You can easily find out which version you are using by typing echo $BASH_VERSION. The
earliest public version of bash was 1.0, and the most recent is 2.01 (released in May 1997). If you have an
older version, you might like to upgrade to the latest one. Chapter 11 , shows you how to go about it.
[] Even though version 2.0 has been out for a while, bash version 1.14.x is still in widespread use. Throughout
this book we have clearly marked with footnotes the features that are not present in the earlier versions.
bash Versions
4
 
5/338
1
Summary of bash Features
bash is a backward−compatible evolutionary successor to the Bourne shell that includes most of the C shell's
major advantages as well as features from the Korn shell and a few new features of its own. Features
appropriated from the C shell include:
· Directory manipulation, with the pushd, popd, and dirs commands.
· Job control, including the fg and bg commands and the ability to stop jobs with CTRL−Z.
· Brace expansion, for generating arbitrary strings.
· Tilde expansion, a shorthand way to refer to directories.
· Aliases, which allow you to define shorthand names for commands or command lines.
· Command history, which lets you recall previously entered commands.
bash's major new features include:
· Command−line editing, allowing you to use vi− or emacs−style editing commands on your command
lines.
· Key bindings that allow you to set up customized editing key sequences.
· Integrated programming features: the functionality of several external UNIX commands, including test,
expr, getopt, and echo, has been integrated into the shell itself, enabling common programming tasks to be
done more cleanly and efficiently.
· Control structures, especially the select construct, which enables easy menu generation.
· New options and variables that give you more ways to customize your environment.
· One dimensional arrays that allow easy referencing and manipulation of lists of data.
· Dynamic loading of built−ins, plus the ability to write your own and load them into the running shell.
Summary of bash Features
5
Zgłoś jeśli naruszono regulamin