BASENAME(1)                 NetBSD Reference Manual                BASENAME(1)

NNAAMMEE
     bbaasseennaammee, ddiirrnnaammee - return filename or directory portion of pathname

SSYYNNOOPPSSIISS
     bbaasseennaammee _s_t_r_i_n_g [_s_u_f_f_i_x]
     ddiirrnnaammee _s_t_r_i_n_g

DDEESSCCRRIIPPTTIIOONN
     BBaasseennaammee deletes any prefix ending with the last slash `/' character pre-
     sent in _s_t_r_i_n_g, and a _s_u_f_f_i_x, if given.  The resulting filename is writ-
     ten to the standard output.  A non-existent suffix is ignored.

     DDiirrnnaammee deletes the filename portion, beginning with the last slash `/'
     character to the end of _s_t_r_i_n_g, and writes the result to the standard
     output.

EEXXAAMMPPLLEESS
     The following line sets the shell variable FOO to _/_u_s_r_/_b_i_n.

           FOO=`dirname /usr/bin/trail`

     Both the bbaasseennaammee and ddiirrnnaammee utilities exit 0 on success, and >0 if an
     error occurs.

SSEEEE AALLSSOO
     csh(1),  sh(1)

SSTTAANNDDAARRDDSS
     The bbaasseennaammee and ddiirrnnaammee utilities conform to IEEE Std1003.2-1992
     (``POSIX.2'').

BSD Experimental              September 15, 1996                             1
