Revision 14707
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
727 | 727 |
|
728 | 728 |
canon_rel_path() # usage: [base_dir=...] canon_rel_path path |
729 | 729 |
{ |
730 |
kw_params base_dir; local base_dir="${base_dir-$PWD}" |
|
730 |
kw_params base_dir; local path="$1" base_dir="${base_dir-$PWD}"
|
|
731 | 731 |
base_dir="$(realpath "$base_dir")" || return |
732 |
local path; path="$(realpath "$1")" || return
|
|
732 |
local path; path="$(realpath "$path")" || return
|
|
733 | 733 |
rel_path |
734 | 734 |
} |
735 | 735 |
|
Also available in: Unified diff
lib/sh/util.sh: canon_rel_path(): import $1 to $path before function body, so that the function body can be moved to a nested function