Korn Shell: Unix and Linux Programming Manual, Third Edition, The By Anatole Olczak
Table of Contents
Appendix D. Sample Korn Shell Scripts
Dirname - kdirname
Here is the Korn shell version of the Unix dirname command. It returns a pathname minus the last directory. As in kbasename, the substring feature does all the work.