February 2001
Beginner to intermediate
448 pages
9h 2m
English
Official Description
autoload is an alias for typeset -fu.
Syntax
autoload function_name
Options
None
Oddities
autoload enables the shell to recognize a name as a function name (-f) but not bother reading the function until it is actually needed (-u leaves the function undefined). This saves shell processing time in the event that the function is never used during the script run.
Example
$ cat funca function funca { print "In funca" } $ $ print $FPATH $ $ pwd /home/obrien $ $ FPATH=/home/obrien # FPATH variable must include path # of file containing function $ $ autoload funca # Make ksh aware of function funca $ $ typeset –f # Not loaded yet typeset -fu funca mc() { mkdir -p ~/.mc/tmp 2> /dev/null chmod 700 ~/.mc/tmp MC=~/.mc/tmp/mc$$-"$RANDOM" ...Read now
Unlock full access