Revision 9040
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
|
116 |
#### paths |
|
117 |
|
|
118 |
canon_rel_path () |
|
119 |
{ |
|
120 |
local path="$1" |
|
121 |
path="$(realpath "$path")" # canonicalize |
|
122 |
path="${path#$(pwd -P)/}" # remove any shared prefix with the current dir |
|
123 |
echo "$path" |
|
124 |
} |
|
125 |
|
|
126 |
|
|
116 | 127 |
#### verbose output |
117 | 128 |
|
118 | 129 |
# usage: (stdout2stderr; cmd...) || return |
... | ... | |
169 | 180 |
# commands that are always external |
170 | 181 |
for cmd in env; do alias "$cmd=extern $cmd"; done; unset cmd |
171 | 182 |
|
172 |
canon_rel_path () |
|
173 |
{ |
|
174 |
local path="$1" |
|
175 |
path="$(realpath "$path")" # canonicalize |
|
176 |
path="${path#$(pwd -P)/}" # remove any shared prefix with the current dir |
|
177 |
echo "$path" |
|
178 |
} |
|
179 |
|
|
180 | 183 |
function echo_func () |
181 | 184 |
{ |
182 | 185 |
inc_log_level |
Also available in: Unified diff
lib/sh/util.sh: moved canon_rel_path () into separate paths section