931:55c477df9d1b | 932:f87943eb16aa |
---|---|
1 realpath() { | |
2 local dir="$(dirname -- "$1")" | |
3 local file="$(basename -- "$1")" | |
4 (cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file") | |
5 } | |
6 | |
1 stubexec() { | 7 stubexec() { |
2 local real_bin="$(which -a $(basename $0) | grep -v $0 | head -n 1)" | 8 local real_me="$(realpath "$0")" |
9 local real_bin="$(which -a $(basename $0) | grep -v "$real_me" | head -n 1)" | |
3 if [ -x "$real_bin" ]; then | 10 if [ -x "$real_bin" ]; then |
4 exec $real_bin $* | 11 exec $real_bin $* |
5 fi | 12 fi |
6 } | 13 } |