You are previewing Korn Shell Programming by Example.
O'Reilly logo
Korn Shell Programming by Example

Book Description

Korn Shell Programming by Example is a straight-forward, nuts and bolts book that will become a standard in the libraries of Unix administrators everywhere because of its real-life examples, progressive style, and lack of unnecessary fluff. Based on the Korn shell, it is an essential reference for administrators on how to program their system, and it is also beneficial for those new to Unix who need to know how to automate their system. Most of all, Korn Shell Programming by Example teaches and arms readers with the ability to solve problems they might encounter.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Acknowledgments
  4. Introduction
  5. The Environment
    1. What Is a Shell?
    2. What Is a Shell Script?
    3. #!/bin/ksh Explained
    4. Coming Full Circle—Back to umask
    5. #—Comments Explained
    6. The .profile Script
    7. Aliases
    8. Ksh Environment Options
    9. Variables
    10. Environment File
    11. History File and Repetition
  6. Process Control
    1. How to Run a Script
    2. Jobs and Processes
    3. Signals
    4. nohup Explained
    5. Scheduling Jobs
  7. Variables
    1. Case Sensitivity
    2. Valid Characters
    3. Scalar
    4. Array
    5. Read-Only
    6. Unsetting
  8. Regular Expressions
    1. Regular Expressions Versus Wildcards
    2. Character Classes
    3. Pattern Matching
    4. Metacharacters
    5. Back References
  9. Quoting
    1. Escape Character
    2. Aggregate Quoting Options
    3. Line Continuation
    4. Command Substitution—Two Ways
    5. Parameter Expansion
    6. Arithmetic Expansion
  10. Flow Control
    1. If Test
    2. Compound If Tests
    3. case Conditionals
    4. Looping Constructs
    5. Loop-Related Commands
    6. Backup Loop Example
  11. Data Manipulation
    1. Functions
    2. Function Programming Details
    3. Math
    4. Filters
    5. Testing Files
  12. Information Passing
    1. Command-Line Arguments
    2. User Input
    3. Redirection
    4. Coprocess
  13. File and Directory Manipulation
    1. Paths
    2. Descriptors
    3. Special Files
    4. Links
    5. Directories
    6. Hidden Files
    7. Attributes
    8. Permissions
    9. Acceptable Filenames
    10. Accessing Files
    11. Filtering
    12. Using Temporary Files
  14. Output Control
    1. Echoing Output
    2. printf
    3. Output Redirection
    4. Multiple Output Redirection
    5. Pipes Versus Redirection
    6. stderr Redirection
    7. Here Documents
  15. Diagnostics
    1. Syntax Checking
    2. Command Interpretation Sequence
    3. Verbose Mode
    4. Execution Trace
    5. Debugging Hooks
  16. Traps
    1. Defining and Using Traps
    2. Documentation Support
    3. Self-Help Scripts
    4. Bulletproofing
  17. Pulling It All Together
    1. The sys_check Script
    2. First sys_check Run
    3. Second sys_check Run
    4. Numbered Version of sys_check Script
  18. Useful Commands
    1. alias
    2. autoload
    3. bg
    4. break
    5. builtin
    6. case
    7. cat
    8. cd
    9. chmod
    10. command
    11. continue
    12. cp
    13. cut
    14. date
    15. disown
    16. echo
    17. ed
    18. eval
    19. exec
    20. exit
    21. export
    22. false
    23. fc
    24. fg
    25. find
    26. float
    27. for
    28. function
    29. getconf
    30. getopts
    31. grep
    32. hash
    33. hist
    34. history
    35. if
    36. integer
    37. jobs
    38. kill
    39. [
    40. let
    41. ln
    42. mv
    43. newgrp
    44. nohup
    45. :
    46. paste
    47. print
    48. printf
    49. pwd
    50. r
    51. read
    52. readonly
    53. return
    54. rm
    55. rmdir
    56. script
    57. select
    58. set
    59. shift
    60. sleep
    61. sort
    62. stop
    63. tail
    64. tee
    65. test
    66. time
    67. touch
    68. tr
    69. trap
    70. true
    71. tty
    72. type
    73. typeset
    74. ulimit
    75. umask
    76. unalias
    77. uniq
    78. unset
    79. until
    80. wait
    81. wc
    82. whence
    83. while
    84. who
  19. vi Tutorial
    1. Where vi Came From
    2. Starting an Edit Session
    3. Modes of Operation
    4. Last-Line Mode
    5. Exiting from the Editor
    6. Moving the Cursor
    7. Deleting
    8. Cutting and Pasting
    9. Using Multiple Buffers
    10. Searching and Replacing
    11. Changing vi Environment Settings
    12. Edit Session Recovery
    13. Miscellaneous Commands
  20. Index