Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
5Activity
0 of .
Results for:
No results containing your search query
P. 1
Korn Shell (Ksh) Programming

Korn Shell (Ksh) Programming

Ratings: (0)|Views: 782|Likes:
Published by azertyui30008561

More info:

Published by: azertyui30008561 on May 15, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/27/2012

pdf

text

original

 
Korn Shell (ksh)Programming
Tutorial
Philip BrownThis material is copyrighted by Philip Brown, © January 2002-2009
 
1
Contents
1. Introduction......................................................................................................................................... 41.1. Why scripting?.............................................................................................................................. 41.2. What can you do with ksh?.......................................................................................................... 41.3. Why ksh, not XYZsh for programming?........................................................................................ 52. Ksh preparedness................................................................................................................................ 52.1. Step 0. Learn how to type. ........................................................................................................... 52.2. Step 1. Learn how to use a text editor......................................................................................... 52.3. Step 2. Understand variables. ...................................................................................................... 62.4. Step 3. Put everything in appropriate variables........................................................................... 62.5. Step 4. Know your quotes ............................................................................................................ 73. Ksh basics............................................................................................................................................. 83.1. Conditionals.................................................................................................................................. 83.1.1. IF............................................................................................................................................ 83.1.2. CASE....................................................................................................................................... 83.2. Loops ............................................................................................................................................ 93.2.1. WHILE.................................................................................................................................... 93.2.2. UNTIL..................................................................................................................................... 93.2.3. FOR........................................................................................................................................ 94. Advanced variable usage...................................................................................................................104.1. Braces.........................................................................................................................................104.2. Arrays..........................................................................................................................................104.3. Special variables.........................................................................................................................114.4. Tweaks with variables ................................................................................................................115. Ksh and POSIX utilities.......................................................................................................................125.1. cut...............................................................................................................................................125.2. join..............................................................................................................................................125.3. comm..........................................................................................................................................125.4. fmt..............................................................................................................................................135.5. grep and egrep...........................................................................................................................135.6. sed..............................................................................................................................................135.7. awk .............................................................................................................................................146. Ksh Functions.....................................................................................................................................146.1. Why are functions critical?.........................................................................................................14
 
26.2. A trivial function.........................................................................................................................156.3. Debugging your functions ..........................................................................................................156.4. CRITICAL ISSUE: exit vs return....................................................................................................156.5. CRITICAL ISSUE: "scope" for function variables!........................................................................166.6. Write Comments!.......................................................................................................................177. Ksh built-in functions.........................................................................................................................177.1. Read and Set...............................................................................................................................187.2. The test function ........................................................................................................................187.3. Built-in math...............................................................................................................................188. Redirection and Pipes........................................................................................................................198.1. Redirection.................................................................................................................................198.2. Inline redirection........................................................................................................................209. Pipes..................................................................................................................................................219.1. Combining pipes and redirection...............................................................................................219.2. Indirect redirection (Inline files).................................................................................................2110. Other Stuff.......................................................................................................................................2210.1. eval...........................................................................................................................................2210.2. Backticks...................................................................................................................................2210.3. Text positioning/color games...................................................................................................2310.4. Number-based menus..............................................................................................................2310.5. Raw TCP access.........................................................................................................................2410.6. Graphics and ksh ......................................................................................................................2411. Paranoia, and good programming practices...................................................................................2411.1. Comment your code.................................................................................................................2511.2. INDENT!....................................................................................................................................2511.3. Error checking...........................................................................................................................2611.4. cron job paranoia.....................................................................................................................2712. Example of script development.......................................................................................................2812.1. The good, the bad, and the ugly...............................................................................................2812.2. The newbie progammer version..............................................................................................2812.3. The sysadmin-in-training version.............................................................................................2912.4. The Senior Admin version ........................................................................................................2912.5. The Senior Systems Programmer version ................................................................................3013. Summary of positive features .........................................................................................................33

Activity (5)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
moonlight1192000 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->