File: util.sh

package info (click to toggle)
libhtml5parser-java 1.4+r1.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,376 kB
  • sloc: java: 27,064; cpp: 158; xml: 141; sh: 136; ruby: 44; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 355 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env sh

abs() {
    local rel
    local p
    if [ $# -ne 1 ]
    then
        rel=.
    else
        rel=$1
    fi
    if [ -d $rel ]
    then
        pushd $rel > /dev/null
        p=`pwd`
        popd > /dev/null
    else
        pushd `dirname $rel` > /dev/null
        p=`pwd`/`basename $rel`
        popd > /dev/null
    fi
    echo $p
}