V4.1 cover Front cover Korn and Bash Shell Programming (Course code AL32) Student Notebook ERC 1.0 IBM Certified Course Material Student Notebook Trademarks IBM® is a registered trademark of International Business Machines Corporation. The following are trademarks of International Business Machines Corporation in the United States, or other countries, or both: AIX® AIX 5L™ Language Environment® OS/2® POWER™ RISC System/6000® RS/6000® Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. Windows is a trademark of Microsoft Corporation in the United States, other countries, or both. UNIX® is a registered trademark of The Open Group in the United States and other countries. Linux® is a registered trademark of Linus Torvalds in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of others. October 2007 edition The information contained in this document has not been submitted to any formal IBM test and is distributed on an “as is” basis without any warranty either express or implied. The use of this information or the implementation of any of these techniques is a customer responsibility and depends on the customer’s ability to evaluate and integrate them into the customer’s operational environment. While each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will result elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk. © Copyright International Business Machines Corporation 2007. All rights reserved. This document may not be reproduced in whole or in part without the prior written permission of IBM. Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. V4.1 Student Notebook TOC Contents Trademarks . xi Course description . xiii Agenda . xv Unit 1. Basic Shell Concepts . .1-1 Unit Objectives . 1-2 Shells . 1-3 This Course . 1-5 Directories . 1-6 Basic File Commands . 1-7 A File . 1-8 AIX File Names . 1-9 What Is a Shell Script? . 1-10 Invoking Shells . 1-11 Invoking Scripts . 1-12 Korn Shell Configuration Files . 1-13 What Are Metacharacters? . 1-15 Wildcard Metacharacters . 1-16 Sample Directory . 1-17 Expansion Examples . 1-18 More Shell Metacharacters . 1-19 Quoting Metacharacters . 1-20 Process I/O . 1-21 Input Redirection . 1-22 Output Redirection . 1-23 Output Appending . 1-24 Association . 1-25 Setting I/O or File Descriptors . 1-26 Setting I/O Descriptor Examples . 1-27 Pipes . 1-28 Command Grouping { { and ( ) . 1-29 Background Processing . 1-30 Shell Job Control . 1-31 Job Control Example . 1-32 Command Substitution . 1-33 Command Substitution Examples (1 of 2) . 1-34 Command Substitution Examples (2 of 2) . 1-35 Command Line Editing and Recall . 1-36 Checkpoint . 1-38 Unit Summary . 1-39 © Copyright IBM Corp. 2007 Contents iii Course materials may not be reproduced in whole or in part without the prior written permission of IBM. Student Notebook Unit 2. Variables. 2-1 Unit Objectives . .2-2 Setting Variables . .2-3 Referencing Variables . .2-4 Positional Parameters . .2-5 Setting Positional Parameters . .2-6 Variable Parameters . .2-7 Some Shell Parameters . .2-8 Shifting Arguments . .2-9 Parameter Code Example . .2-10 Parameter Output Example . .2-11 This Shell and the Next . .2-12 Inheritance Example - The export Command . .2-13 Korn Shell Variables . .2-14 Environment Variables . .2-15 Korn Environment Variables (1 of 2) . .2-16 Korn Environment Variables (2 of 2) . .2-17 Korn Shell 93 Variables . .2-18 Bash Environment Variables . .2-19 Checkpoint . .2-20 Unit Summary . .2-21 Unit 3. Return Codes and Traps . 3-1 Unit Objectives . .3-2 Return Values . .3-3 Exit Status . .3-4 Conditional Execution . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages352 Page
-
File Size-