COHERENT manpages

This page displays the COHERENT manpage for dirname [Extract a directory name].

List of available manpages
Index


dirname -- Command

Extract a directory name
dirname string

The command dirname extracts a directory name from a file's full path name.
In effect, it is the complement of the command basename.

If string contains  one or more slashes `/' plus  text, then dirname prints
out the  portion of string up  to (but not including)  the last slash.  For
example, if string points to /bin/sh, then dirname will return /bin.

If  string does not  contain a  slash or  is empty (that  is points  to the
current directory),  dirname prints a  single period `.'.   For example, if
string points to myprogram, then dirname returns a period.

Finally, if string consists only of  one slash (that is, indicates the root
directory), then dirname returns /.

See Also

basename,
commands,
cut,
paste