1. Trang chủ
  2. » Khoa Học Tự Nhiên

Unix shell pro

942 58 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 942
Dung lượng 3,62 MB

Nội dung

This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Table of Contents Index Unixđ Shell Programming, Third Edition By Stephen G Kochan, Patrick Wood Publisher: Sams Publishing Pub Date: February 27, 2003 ISBN: 0-672-32490-3 Pages: 456 Slots: Unix Shell Programming is a tutorial aimed at helping Unix and Linux users get optimal performance out of their operating out of their operating system It shows them how to take control of their systems and work efficiently by harnessing the power of the shell to solve common problems The reader learns everything he or she needs to know to customize the way a Unix system responds The vast majority of Unix users utilize the Korn shell or some variant of the Bourne shell, such as bash Three are covered in the third edition of Unix Shell Programming It begins with a generalized tutorial of Unix and tools and then moves into detailed coverage of shell programming Topics covered include: regular expressions, the kernel and the utilities, command files, parameters, manipulating text filters, understanding and debugging shell scripts, creating and utilizing variables, tools, processes, and customizing the shell This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com • • Table of Contents Index Unix® Shell Programming, Third Edition By Stephen G Kochan, Patrick Wood Publisher: Sams Publishing Pub Date: February 27, 2003 ISBN: 0-672-32490-3 Pages: 456 Slots: Copyright About the Authors We Want to Hear from You! Reader Services Chapter Introduction Chapter A Quick Review of the Basics Some Basic Commands Working with Files Working with Directories Filename Substitution Standard Input/Output and I/O Redirection Pipes Standard Error More on Commands Command Summary Exercises Chapter What Is the Shell? The Kernel and the Utilities The Login Shell Typing Commands to the Shell The Shell's Responsibilities Chapter Tools of the Trade Regular Expressions cut paste sed tr grep sort uniq Exercises Chapter And Away We Go Command Files This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Command Files Variables Built-in Integer Arithmetic Exercises Chapter Can I Quote You on That? The Single Quote The Double Quote The Backslash Command Substitution Exercises Chapter Passing Arguments The $# Variable The $* Variable A Program to Look Up Someone in the Phone Book A Program to Add Someone to the Phone Book A Program to Remove Someone from the Phone Book ${n} The shift Command Exercises Chapter Decisions, Decisions Exit Status The test Command The else Construct The exit Command The elif Construct The case Command The Null Command : The && and || Constructs Exercises Chapter 'Round and 'Round She Goes The for Command The until Command More on Loops The getopts Command Exercises Chapter 10 Reading and Printing Data The read Command The printf Command Exercises Chapter 11 Your Environment Local Variables Exported Variables PS1 and PS2 HOME, James Your PATH Your Current Directory More on Subshells Your profile File The TERM Variable The TZ Variable Exercises Chapter 12 More on Parameters Parameter Substitution This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com The $0 Variable The set Command The IFS Variable The readonly Command The unset Command Exercises Chapter 13 Loose Ends The eval Command The wait Command The trap Command More on I/O Functions The type Command Exercises Chapter 14 Rolo Revisited Design Considerations rolo add lu display rem change listall Sample Output Exercises Chapter 15 Interactive and Nonstandard Shell Features Getting the Right Shell The ENV File Command-Line Editing Command History The vi Line Edit Mode The Line Edit Mode Other Ways to Access Your History Functions Integer Arithmetic The alias Command Arrays Job Control The Restricted Shell rsh Miscellaneous Features Compatibility Summary Exercises Appendix A Shell Summary Startup Commands Comments Parameters and Variables Command Re-entry Quoting Filename Substitution I/O Redirection Exported Variables and Subshell Execution Functions This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Functions Job Control Command Summary Appendix B For More Information Online Documentation Documentation on the Web Books Index This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Copyright Copyright © 2003 by Sams Publishing All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the information contained herein Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions Nor is any liability assumed for damages resulting from the use of the information contained herein Library of Congress Catalog Card Number: 2002115932 Printed in the United States of America First Printing: March 2003 06 05 04 03 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized Sams Publishing cannot attest to the accuracy of this information Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied The information provided is on an "as is" basis The authors and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book Credits Acquisitions Editor Katie Purdum Development Editor Scott Meyers Managing Editor Charlotte Clapp Copy Editor Geneil Breeze Indexer Erika Millen Proofreader Jessica McCarty Technical Editor Michael Watson Interior Designer Gary Adair Cover Designer This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Cover Designer Gary Adair Page Layout Susan Geiselman Dedication To my father, Harry Wood —Patrick Wood To Gregory, Linda, and Julia for giving meaning to my life —Stephen G Kochan This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com About the Authors Stephen G Kochan is the owner of TechFitness, a technology-based fitness company Prior to that, he was president and CEO of Pipeline Associates, a company specializing in color printing software Mr Kochan is the author of several best-selling books on Unix and C programming, including the best-selling Programming in C He also acted as Series Editor for the Hayden Unix System Library Patrick Wood is the CTO of the New Jersey location of Electronics for Imaging He was a member of the technical staff at Bell Laboratories when he met Mr Kochan in 1985 Together they founded Pipeline Associates, Inc., a Unix consulting firm, where he was the Vice President They coauthored Exploring the Unix System, Unix System Security, Topics in C Programming, and Unix Shell Programming This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com We Want to Hear from You! As the reader of this book, you are our most important critic and commentator We value your opinion and want to know what we're doing right, what we could better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way You can email or write me directly to let me know what you did or didn't like about this book—as well as what we can to make our books stronger Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message When you write, please be sure to include this book's title and author as well as your name and phone or email address I will carefully review your comments and share them with the author and editors who worked on the book Email: feedback@samspublishing.com Mail: Mark Taber Associate Publisher Sams Publishing 201 West 103rd Street Indianapolis, IN 46290 USA This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Reader Services For more information about this book or others from Sams Publishing, visit our Web site at www.samspublishing.com Type the ISBN (excluding hyphens) or the title of the book in the Search box to find the book you're looking for This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com specific characters 2nd 3rd summary of regular expressions 2nd zero or more characters 2nd 3rd 4th searching grep command 2nd 3rd 4th 5th 6th 7th 8th 9th 10th tilde (~) tilde substitution 2nd 3rd 4th tilde substitution 2nd 3rd 4th tile (~) tilde substitution time recording amount used time zones TZ variable 2nd time/date displaying date command 2nd times command 2nd tools [See commands]2nd [See commands] tr command -d option 2nd -s option 2nd examples 2nd 3rd 4th 5th 6th 7th syntax trace mode disabling enabling 2nd translating characters from standard input 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th trap command 2nd 3rd 4th 5th 6th 7th 8th executing without arguments 2nd ignoring signals 2nd resetting traps 2nd signal numbers syntax traps creating 2nd 3rd displaying 2nd resetting 2nd signal numbers 2nd true command tutorials twhile program 2nd type command 2nd 3rd 4th types integer 2nd types (data) TZ variable 2nd This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] u command (vi) U command (vi) u conversion specification character u option sort command 2nd u option (set command) umask command 2nd unalias command 2nd underscore (_) 2nd uniq command -c option -d option 2nd 3rd examples 2nd 3rd syntax Unix C Shell Field Guide, The Unix in a Nutshell[colon] System V Edition Unix Programmer's Manual, Volume II Unix Programming Environment, The 2nd Unix Unleashed unset command 2nd 3rd 4th until command 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th examples 2nd 3rd 4th 5th 6th 7th 8th syntax 2nd User's Reference Manual/System Administrator's Reference Manual users logged-in users displaying 2nd utilities [See also commands, shell] defined utilities [See commands] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] v () escape character v option grep command 2nd v option (set command) values assigning to keyword parameters 2nd assigning to variables 2nd 3rd comparing with case command command syntax 2nd 3rd pattern matching characters 2nd 3rd 4th pipe symbol (|) 2nd 3rd displaying null values 2nd 3rd reassigning to positional parameters 2nd 3rd variables 2nd 3rd 4th 5th $! $! variable 2nd $# $# variable 2nd 3rd $$ $$ variable $* $* variable 2nd 3rd $$? $? variable 2nd 3rd 4th 5th 6th $@ $@ variable 2nd 3rd ${n} variable 2nd ${variable} construct (***italicize variable) 2nd $0 $0 variable 2nd arithmetic expansion 2nd 3rd assigning to other variables assigning values to 2nd assigning variables to CDPATH 2nd 3rd 4th displaying values of ENV 2nd examples 2nd exporting 2nd 3rd 4th 5th 6th 7th 8th 9th 10th FCEDIT 2nd filename substitution 2nd 3rd FPATH HISTFILE 2nd HISTSIZE 2nd HOME 2nd 3rd IFS IFS variable 2nd 3rd 4th 5th LINENO listing 2nd local variables 2nd MAIL MAILCHECK MAILPATH This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com naming conventions null values 2nd 3rd passing to subshells 2nd 3rd 4th PATH 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th PHONEBOOK 2nd 3rd 4th 5th pointers creating positional parameters defined 2nd left shifting 2nd 3rd PPID PS1 2nd 3rd PS2 2nd 3rd PS4 PWD read-only variables 2nd creating 2nd removing from environment 2nd TERM 2nd TZ 2nd unsetting 2nd 3rd variable substitution 2nd vartest program 2nd vartest2 program 2nd vartest3 program 2nd vartest4 program 2nd vartest5 program verbose shell mode vi line edit mode 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th command mode commands 2nd 3rd 4th 5th 6th $ 2nd / 2nd 3rd 2nd a 2nd b 2nd dw h 2nd 3rd i 2nd j 2nd 3rd k 2nd 3rd l 2nd 3rd r w 2nd x 2nd 3rd input mode vi shell mode This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] w (-w) operator w command (vi) 2nd w option wc command wait command 2nd $! variable 2nd example syntax 2nd waiting for processes 2nd 3rd 4th 5th wc command 2nd Web sites 2nd Cygwin Free Software Foundation Korn shell 2nd O'Reilly and Associates Web site POSIX standard while command 2nd 3rd 4th 5th whitespace characters who command 2nd words counting wc command 2nd working directory printing 2nd writing sorted data to standard output 2nd to standard error 2nd This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] x (-x) operator x command (vi) 2nd 3rd x conversion specification character X conversion specification character x option set command 2nd sh command 2nd 3rd 4th x option (set command) xtrace shell mode This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] Y command (vi) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] zero (0) exit status zero exit status This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com • • Table of Contents Index Unix® Shell Programming, Third Edition By Stephen G Kochan, Patrick Wood Publisher: Sams Publishing Pub Date: February 27, 2003 ISBN: 0-672-32490-3 Pages: 456 Slots: Unix Shell Programming is a tutorial aimed at helping Unix and Linux users get optimal performance out of their operating out of their operating system It shows them how to take control of their systems and work efficiently by harnessing the power of the shell to solve common problems The reader learns everything he or she needs to know to customize the way a Unix system responds The vast majority of Unix users utilize the Korn shell or some variant of the Bourne shell, such as bash Three are covered in the third edition of Unix Shell Programming It begins with a generalized tutorial of Unix and tools and then moves into detailed coverage of shell programming Topics covered include: regular expressions, the kernel and the utilities, command files, parameters, manipulating text filters, understanding and debugging shell scripts, creating and utilizing variables, tools, processes, and customizing the shell This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com About the Authors Stephen G Kochan is the owner of TechFitness, a technology-based fitness company Prior to that, he was president and CEO of Pipeline Associates, a company specializing in color printing software Mr Kochan is the author of several best-selling books on Unix and C programming, including the best-selling Programming in C He also acted as Series Editor for the Hayden Unix System Library Patrick Wood is the CTO of the New Jersey location of Electronics for Imaging He was a member of the technical staff at Bell Laboratories when he met Mr Kochan in 1985 Together they founded Pipeline Associates, Inc., a Unix consulting firm, where he was the Vice President They coauthored Exploring the Unix System, Unix System Security, Topics in C Programming, and Unix Shell Programming This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com We Want to Hear from You! As the reader of this book, you are our most important critic and commentator We value your opinion and want to know what we're doing right, what we could better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way You can email or write me directly to let me know what you did or didn't like about this book—as well as what we can to make our books stronger Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message When you write, please be sure to include this book's title and author as well as your name and phone or email address I will carefully review your comments and share them with the author and editors who worked on the book Email: feedback@samspublishing.com Mail: Mark Taber Associate Publisher Sams Publishing 201 West 103rd Street Indianapolis, IN 46290 USA This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Table of Contents Index Unixđ Shell Programming, Third Edition By Stephen G Kochan, Patrick Wood Publisher: Sams Publishing Pub Date: February 27, 2003 ISBN: 0-672-32490-3 Pages: 456 Slots: Copyright About the Authors We Want to Hear from You! Reader Services Chapter Introduction Chapter A Quick Review of the Basics Some Basic Commands Working with Files Working with Directories Filename Substitution Standard Input/Output and I/O Redirection Pipes Standard Error More on Commands Command Summary Exercises Chapter What Is the Shell? The Kernel and the Utilities The Login Shell Typing Commands to the Shell The Shell's Responsibilities Chapter Tools of the Trade Regular Expressions cut paste sed tr grep sort uniq Exercises Chapter And Away We Go Command Files This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Command Files Variables Built-in Integer Arithmetic Exercises Chapter Can I Quote You on That? The Single Quote The Double Quote The Backslash Command Substitution Exercises Chapter Passing Arguments The $# Variable The $* Variable A Program to Look Up Someone in the Phone Book A Program to Add Someone to the Phone Book A Program to Remove Someone from the Phone Book ${n} The shift Command Exercises Chapter Decisions, Decisions Exit Status The test Command The else Construct The exit Command The elif Construct The case Command The Null Command : The && and || Constructs Exercises Chapter 'Round and 'Round She Goes The for Command The until Command More on Loops The getopts Command Exercises Chapter 10 Reading and Printing Data The read Command The printf Command Exercises Chapter 11 Your Environment Local Variables Exported Variables PS1 and PS2 HOME, James Your PATH Your Current Directory More on Subshells Your profile File The TERM Variable The TZ Variable Exercises Chapter 12 More on Parameters Parameter Substitution This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com The $0 Variable The set Command The IFS Variable The readonly Command The unset Command Exercises Chapter 13 Loose Ends The eval Command The wait Command The trap Command More on I/O Functions The type Command Exercises Chapter 14 Rolo Revisited Design Considerations rolo add lu display rem change listall Sample Output Exercises Chapter 15 Interactive and Nonstandard Shell Features Getting the Right Shell The ENV File Command-Line Editing Command History The vi Line Edit Mode The Line Edit Mode Other Ways to Access Your History Functions Integer Arithmetic The alias Command Arrays Job Control The Restricted Shell rsh Miscellaneous Features Compatibility Summary Exercises Appendix A Shell Summary Startup Commands Comments Parameters and Variables Command Re-entry Quoting Filename Substitution I/O Redirection Exported Variables and Subshell Execution Functions This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Functions Job Control Command Summary Appendix B For More Information Online Documentation Documentation on the Web Books Index ... Associates, Inc., a Unix consulting firm, where he was the Vice President They coauthored Exploring the Unix System, Unix System Security, Topics in C Programming, and Unix Shell Programming This... POSIX-compliant shells Because the shell offers an interpreted programming language, programs can be written, modified, and debugged quickly and easily We turn to the shell as our first choice of programming... further this end, and also to provide a consistent buffer between the user and the guts of the Unix system (the kernel), the shell was developed The shell is simply a program that reads in the commands

Ngày đăng: 25/03/2019, 15:40

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN