Project

General

Profile

« Previous | Next » 

Revision 8716

lib/util.sh: added realpath () and use it where `readlink -f` is used

View differences:

util.sh
1 1
#!/bin/bash -e
2
include_guard_var () { readlink -f -- "$1"|sed 's/[^a-zA-Z0-9_]/_/g'; }
2
realpath () { readlink -f -- "$1"; }
3 3

  
4
include_guard_var () { realpath "$1"|sed 's/[^a-zA-Z0-9_]/_/g'; }
5

  
4 6
self_not_included () # usage: if self_not_included; then ... fi
5 7
{
6 8
	test "$#" -ge 1 || set -- "${BASH_SOURCE[1]}"
......
29 31
canon_rel_path ()
30 32
{
31 33
	local path="$1"
32
	path="$(readlink -f -- "$path")" # canonicalize
34
	path="$(realpath "$path")" # canonicalize
33 35
	path="${path#$PWD/}" # remove any shared prefix with the current dir
34 36
	echo "$path"
35 37
}

Also available in: Unified diff