path
path
¶
L_basename
¶
The filename
Option:
-v <var>
var
Argument:
$1
path
L_basename_v
¶
L_dirname
¶
parent of the path
Option:
-v <var>
var
Argument:
$1
path
L_dirname_v
¶
L_extension
¶
The last dot-separated portion of the final component, if any.
Option:
-v <var>
var
Argument:
$1
path
See: https://en.cppreference.com/w/cpp/filesystem/path/extension.html
L_extension_v
¶
L_extensions
¶
A list of the path’s suffixes, often called file extensions.
Option:
-v <var>
var
Argument:
$1
path
See: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffixes
L_extensions_v
¶
L_stem
¶
The final path component, without its suffix:
Option:
-v <var>
var
Argument:
$1
path
See: https://en.cppreference.com/w/cpp/filesystem/path/stem
L_stem_v
¶
L_is_absolute
¶
Return whether the path is absolute or not.
L_normalize_path
¶
Replace multiple slashes by one slash.
Option:
-v <var>
var
Argument:
$1
path
L_normalize_path_v
¶
Shellcheck disable= SC2064
L_relative_to
¶
Compute a version of the original path relative to the path represented by other path.
Option:
-v <var>
var
Arguments:
-
$1
original path -
$2
other path
See:
- https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.relative_to
- https://stackoverflow.com/a/12498485/9072753
L_relative_to_v
¶
Shellcheck disable= SC2179
L_path_append
¶
Append a path to path variable if not already there.
Example
L_path_append PATH ~/.local/bin
Arguments:
-
$1
Variable name. For example PATH -
$2
Path to append. For example /usr/bin -
[$3]
Optional path separator. Default: ':'
L_path_prepend
¶
Prepend a path to path variable is not already there.
Example
L_path_append PATH ~/.local/bin
Arguments:
-
$1
Variable name. For example PATH -
$2
Path to prepend. For example /usr/bin -
[$3]
Optional path separator. Default: ':'
L_path_remove
¶
Remove a path from a path variable.
Example
L_path_append PATH ~/.local/bin
Arguments:
-
$1
Variable name. For example PATH -
$2
Path to prepend. For example /usr/bin -
[$3]
Optional path separator. Default: ':'