Next: , Previous: , Up: file names   [Contents][Index]


6.1.2 Absolute and relative pathnames

Function: mbfl_file_subpathname pathname basedir
Function: mbfl_file_subpathname_var _RV pathname basedir

If pathname is a subdirectory or file under basedir: print to stdout the subpathname portion. Example:

mbfl_file_subpathname /a/b/c /a
-> ./b/c

Both pathname and basedir must be full (normalised) pathnames for this function to work. If pathname is recognised as subpathname of basedir: the return code is zero; else the return code is one.

The function variant _var stores the result in the variable _RV, rather than print it; Result variables.

mbfl_file_subpathname /a /a       -| ./
mbfl_file_subpathname /a/b/c /a/  -| ./b/c
mbfl_file_subpathname /a/b/c /a   -| ./b/c

mbfl_file_subpathname /a/b/c /d   error→ no match

local _RV
mbfl_file_subpathname_var _RV /a/b/c /a
"$_RV" ⇒ ./b/c
Function: mbfl_file_is_absolute pathname

Return true if the first character in pathname is a slash (/); else return false.

Function: mbfl_file_is_absolute_dirname pathname

Return true if pathname is a directory according to mbfl_file_is_directory() and an absolute pathname according to mbfl_file_is_absolute().

Function: mbfl_file_is_absolute_filename pathname

Return true if pathname is a file according to mbfl_file_is_file() and an absolute pathname according to mbfl_file_is_absolute().

Function: mbfl_file_is_relative pathname

Return true if the first character in pathname is not a slash (/); else return false.

Function: mbfl_file_is_relative_dirname pathname

Return true if pathname is a directory according to mbfl_file_is_directory() and an relative pathname according to mbfl_file_is_relative().

Function: mbfl_file_is_relative_filename pathname

Return true if pathname is a file according to mbfl_file_is_file() and an relative pathname according to mbfl_file_is_relative().


Next: , Previous: , Up: file names   [Contents][Index]

This document describes version 3.0.0-devel.0 of Marcos Bash Functions Library.