dirnamedisplay directory components of path name |
Command |
dirname pathname
dirname strips off the trailing part of a file name. The
result is the path name of the directory that contains the file. This is useful
in shell scripts.
dirname makes no attempt to validate the path name;
for validation, use the
pathchk command.
dirname follows these rules:
//, return one slash
.)
//, return it
.)
dirname returns device names as you type them in
pathname -- if you include a slash, dirname
returns the device name with the following slash; if you don't include a
slash, the device name is returned with no following slash.
producesdirname src/lib/printf.c
src/lib
0Successful completion.
>0An error occurred.