dirname treats
string as a file name and returns the name of the directory containing the file name by deleting the
last component from
string.
If string consists solely of / characters the output will be a single / unless PATH_LEADING_SLASHES
returned by getconf(1) is 1 and string consists of multiple /
characters in which case // will be output. Otherwise, trailing / characters are removed, and if there are no
remaining / characters in string, the string . will be written to standard output. Otherwise, all characters
following the last / are removed. If the remaining string consists solely of / characters, the output will be as if
the original string had consisted solely as / characters as described above. Otherwise, all trailing slashes are removed and
the output will be this string unless this string is empty. If empty the output will be ..