Hi.
As long as one obeys the syntax rules, many forms are possible:
Code:
#!/usr/bin/env ksh
# @(#) s1 Demonstrate syntax allowed for shell functions, ksh.
echo
export LC_ALL=C
echo "Environment: LC_ALL = $LC_ALL"
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1)
echo
one()
{
echo " One called." >&2
return 0
}
two(){
echo " Two called." >&2
return 0
}
three(){ echo " Three called." >&2 ; return 0
}
four(){ echo " Four called." >&2 ; return 0 ; }
echo
echo " Results, calling one, two, three, four."
one
two
three
four
exit 0
producing:
Code:
% ./s1
Environment: LC_ALL = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0
ksh 93s+
Results, calling one, two, three, four.
One called.
Two called.
Three called.
Four called.
Best wishes ... cheers, drl
|