MPE/iX Shell and Utilities Reference Manual, Vol 1

dirname(1) MPE/iX Shell and Utilities dirname(1)
NAME
dirname — display directory components of path name
SYNOPSIS
dirname pathname
DESCRIPTION
dirname strips off the trailing part of a file name. The result is the path name of the direc-
tory that contains the file. This is useful in shell scripts.
Note: dirname makes no attempt to validate the path name; for validation, use
pathchk(1).
dirname follows these rules:
If pathname is //, return it.
Otherwise, if it is all slashes, return one slash.
Otherwise, remove all trailing slashes.
If there are no slashes remaining in pathname , return period (.).
Otherwise, remove trailing non-slash characters.
If the remaining string is //, return it.
Otherwise, remove any trailing slashes.
If the resulting string is empty, return period (.).
Otherwise, return the resulting string.
EXAMPLES
The command
dirname src/lib/printf.c
produces
src/lib
DIAGNOSTICS
Possible exit status values are:
0 Successful completion.
Commands and Utilities 1-187