dirname (host)
Return the directory portion of a pathname (POSIX)
Syntax:
dirname string
Runs on:
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-ticks (`...`), or contained in
    $(...).
CAUTION: 
 The dirname host binary is
      from the MSYS package. It is not designed to work with ASLR
      as on Windows 10 and 11, Force randomization for images
      (Mandatory ASLR ) is disabled by default. If you enable it
      to use ASLR, the date utility will fail
      to load.
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.
 
Page updated: 
