DIRNAME(1)

NAME
dirname - return directory portion of pathname

SYNOPSIS
dirname string [...]
dirname [-z] string [...]

DESCRIPTION
The dirname utility deletes the filename portion, beginning with the last slash ‘/’ character to the end of string (after first stripping trailing slashes), and writes the result to the standard output.

  OPTIONS
[-z|--zero] End each output line with NUL, not newline

[--debug] Enable debug mode

[--help|-?] Print usage and this help message and exit

[--version] Print version and exit

[--] Options processing terminator

ENVIRONMENT
Contrary to the original FreeBSD dirname command, this version takes the POSIXLY_CORRECT environment variable into account, disabling all the command's options except the options terminator (--).

EXIT STATUS

SEE ALSO
basename(1), csh(1), sh(1), dirname(3)

STANDARDS
The dirname utility is expected to be p1003.2 compatible.

This version is fully compatible with the FreeBSD version (apart from the help and error message). It also implements the GNU coreutils version specific options ( -z --zero ).

It tries to follow the PEP 8 style guide for Python code.

PORTABILITY
Tested OK under Windows (though with backslashes instead os slashes, of course).

HISTORY
The dirname utility first appeared in 4.4BSD.

This version was made for the [PNU project]: https://github.com/HubTou/PNU in order to test the [b2bt]: https://github.com/HubTou/b2bt command.

LICENSE
This utility is available under the 3-clause BSD license.

AUTHORS
This version was written by Hubert Tournier.

The man page is derived from the FreeBSD project's one.