Functions

   

Korn Shell: Unix and Linux Programming Manual, Third Edition, The
By Anatole Olczak

Table of Contents
Appendix G.  Pdksh Quick Reference


Functions are a form of commands like aliases, and scripts. They differ from Korn shell scripts, in that they do not have to read in from the disk each time they are referenced, so they execute faster. They also provide a way to organize scripts into routines, like in other high-level programming languages. Since functions can have local variables, recursion is possible. Functions are defined with the following format:

function name { commands; }

Local function variables are declared with the typeset command within the function.

Function Commands

return

return from a function

return n

return from a function; pass back return value of n

typeset f

display a list of functions and their definitions

typeset +f

display a list of function names only

typeset fu

display a list of autoloading functions

typeset fu name

 

make function name autoloading

typeset ft name

 

display function commands and arguments as they are executed

unset f name

remove function name


       
    Top
     



    Korn Shell. Unix and Linux Programming Manual, Third Edition
    Korn Shell. Unix and Linux Programming Manual, Third Edition
    ISBN: N/A
    EAN: N/A
    Year: 2000
    Pages: 177

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net