Realpaths
realpath_location¶
Resolve symlinks and return the parent directory of the target. Result is written to the global REPLY variable, not stdout.
Arguments¶
- $1 (string): Path to resolve
realpath_resolved¶
Resolve symlinks and return the resulting absolute path. Result is written to the global REPLY variable, not stdout.
Arguments¶
- $1 (string): Path to resolve
realpath_dirname¶
Return the directory component of a path. Result is written to REPLY.
Arguments¶
- $1 (string): Path to process
realpath_basename¶
Return the filename component of a path. Result is written to REPLY.
Arguments¶
- $1 (string): Path to process
realpath_follow¶
Resolve all symlinks in a path without resolving path components. Detects symlink loops and stops. Result is written to REPLY.
Arguments¶
- $1 (string): Path to follow
realpath_absolute¶
Compute an absolute path by resolving path components against PWD. Handles ., .., double-slash, and root. Result is written to REPLY.
Arguments¶
- $1 (string): Path component(s) to resolve
realpath_canonical¶
Recursively canonicalise a path: resolve symlinks and normalise all path components. Result is written to REPLY.
Arguments¶
- $1 (string): Path to canonicalise
realpath_relative¶
Compute the relative path from a base directory to a target path. Defaults to PWD as the base if not given. Result is written to REPLY.
Arguments¶
- $1 (string): Target path
- $2 (string): Optional: base directory (default: PWD)
realpath_portable_follow¶
Resolve a symlink chain to its ultimate target using only POSIX tools (ls -dl, not readlink). Handles up to 40 levels of indirection. Unlike other realpath_* functions, writes the resolved path to stdout, not REPLY. Attribution: based on readlinkf_posix by ko1nksm. See NOTICE.md.
Arguments¶
- $1 (string): Path to resolve
Exit codes¶
- 0: Path resolved successfully
- 1: Path not found, too many symlinks, or cd failed
Output on stdout¶
- Resolved absolute path