Below are ksh function replacements for basename and dirname:
# Using ksh pattern-matching operators, this function
# replaces the unix basename command. If a 2nd argument
# exists, strip off the extension.
function basename {
typeset v x
v=${1##*/}
x=${2#.} # get rid of the '.'
v=${v%.$x}
echo $v
}
# Using ksh pattern-matching operators, this function
# replaces the unix dirname command.
function dirname {
typeset v="$@"
echo ${v%/*}
}
# basename and dirname function examples
var=/usr/eds/ddir/ttest.c
bn=$(basename $var)
echo $bn # displays: ttest.c
bn=$(basename $var .c)
echo $bn # displays: ttest
dn=$(dirname $var)
echo $dn # displays: /usr/eds/ddir