aboutsummaryrefslogtreecommitdiff
path: root/contrib/shunit2-2.0.3/lib/sh/shlib
blob: 00aadcbc0cb96f8b28af262d7c2896cde9a1f7b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# $Id$
# vim:syntax=sh
#
# library of shell functions
#

shlib_relToAbsPath()
{
  _shlib_path=$1

  # deal with paths that start with /
  echo "${_shlib_path}" |grep '^/' >/dev/null 2>&1
  if [ $? -ne 0 ]; then
    _shlib_pwd=`pwd`
    _shlib_path="${_shlib_pwd}/${_shlib_path}"
    unset _shlib_pwd
  fi

  # clean up the path
  echo "${_shlib_path}" |sed 's/[^/]*\/*\.\.\/*//g;s/\/\.\//\//'

  unset _shlib_path
}