diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-02-06 13:03:36 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-04 15:06:30 -0500 |
commit | 974942db43ff2d1fa7ba71ad60f9bb9eae2d8631 (patch) | |
tree | d7235df9d4d6a67753dc2a20ab6bfcb7a24dc74c /realpath/realpath.sh | |
download | cbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.tar.gz cbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.tar.bz2 cbt-974942db43ff2d1fa7ba71ad60f9bb9eae2d8631.zip |
CBT Version 1.0-BETA
Diffstat (limited to 'realpath/realpath.sh')
-rwxr-xr-x | realpath/realpath.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/realpath/realpath.sh b/realpath/realpath.sh new file mode 100755 index 0000000..de4d964 --- /dev/null +++ b/realpath/realpath.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# is there a realiable cross-platform was to do this without relying on compiling C code? + +DIR=$(dirname $(readlink "$0") 2>/dev/null || dirname "$0" 2>/dev/null ) +which realpath 2>&1 > /dev/null +REALPATH_INSTALLED=$? + +if [ ! $REALPATH_INSTALLED -eq 0 ]; then + if [ ! -f $DIR/realpath ]; then + >&2 echo "Compiling realpath" + gcc $DIR/realpath.c -o $DIR/realpath + chmod u+x $DIR/realpath + fi + $DIR/realpath $1 +else + realpath $1 +fi |