Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/d/dirname.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/d/dirname.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/d/dirname.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/d/dirname.html on line 8

dirname

Return the directory portion of a pathname (POSIX)

Syntax:

dirname string

Runs on:

QNX Neutrino, Linux, Microsoft Windows

Options:

None.

Description:

The dirname utility returns a portion of the string operand to standard output. The string operand represents a valid pathname whose format is:

directory_pathname/base_filename

The dirname utility writes the directory_pathname component to standard output.

If string is //, then // is returned. Any other string consisting entirely of slash characters causes a single slash to be returned.

You'll use the dirname utility most often within shell scripts, where it's normally invoked inside back-tick (`...`), or contained in $(...).

Examples:

Command: Output:
dirname . .
dirname .. .
dirname ../. ..
dirname /usr/src/prog.c /usr/src
dirname /usr/src/ /usr
dirname ...//[fred] ...

Exit status:

0
Successful completion.
>0
An error occurred.

See also:

basename


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/d/dirname.html on line 147

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/d/dirname.html on line 147