Dirname - kdirname

   

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.

 #!/bin/ksh  #  #     kdirname - Korn shell dirname  #  # Check arguments  if (($# == 0 || $# > 1))  then        print "Usage: $0 string"        exit 1  fi  # Get the dirname  print ${1%/*} 

       
    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