Permalink
Browse files

eplaced all references to "readlink -f" with BSD/OS X compatible "can…

…onical_readlink" function
  • Loading branch information...
2 parents 31f6152 + a29ce8b commit 386b0bf348c5aabc5730b8d731dc401f0795cbb5 @dominictarr committed Oct 26, 2011
Showing with 20 additions and 5 deletions.
  1. +4 −1 all-tests.sh
  2. +4 −1 test/invalid-test.sh
  3. +4 −1 test/parse-test.sh
  4. +4 −1 test/tokenizer-test.sh
  5. +4 −1 test/valid-test.sh
View
@@ -1,6 +1,9 @@
#! /usr/bin/env bash
-__filename=`readlink -f $0`
+# Define BSD-friendly canonicalized readlink
+canonical_readlink () { cd `dirname $1`; __filename=`basename $1`; if [ -h "$__filename" ]; then canonical_readlink `readlink $__filename`; else echo "`pwd -P`/$__filename"; fi }
+
+__filename=$(canonical_readlink $0)
__dirname=`dirname $__filename`
cd $__dirname
@@ -1,6 +1,9 @@
#! /usr/bin/env bash
-__filename=`readlink -f $0`
+# Define BSD-friendly canonicalized readlink
+canonical_readlink () { cd `dirname $1`; __filename=`basename $1`; if [ -h "$__filename" ]; then canonical_readlink `readlink $__filename`; else echo "`pwd -P`/$__filename"; fi }
+
+__filename=$(canonical_readlink $0)
__dirname=`dirname $__filename`
cd $__dirname
View
@@ -1,5 +1,8 @@
-__filename=`readlink -f $0`
+# Define BSD-friendly canonicalized readlink
+canonical_readlink () { cd `dirname $1`; __filename=`basename $1`; if [ -h "$__filename" ]; then canonical_readlink `readlink $__filename`; else echo "`pwd -P`/$__filename"; fi }
+
+__filename=$(canonical_readlink $0)
__dirname=`dirname $__filename`
cd $__dirname
@@ -1,6 +1,9 @@
#! /usr/bin/env bash
-__filename=`readlink -f $0`
+# Define BSD-friendly canonicalized readlink
+canonical_readlink () { cd `dirname $1`; __filename=`basename $1`; if [ -h "$__filename" ]; then canonical_readlink `readlink $__filename`; else echo "`pwd -P`/$__filename"; fi }
+
+__filename=$(canonical_readlink $0)
__dirname=`dirname $__filename`
cd $__dirname
View
@@ -1,5 +1,8 @@
-__filename=`readlink -f $0`
+# Define BSD-friendly canonicalized readlink
+canonical_readlink () { cd `dirname $1`; __filename=`basename $1`; if [ -h "$__filename" ]; then canonical_readlink `readlink $__filename`; else echo "`pwd -P`/$__filename"; fi }
+
+__filename=$(canonical_readlink $0)
__dirname=`dirname $__filename`
cd $__dirname

0 comments on commit 386b0bf

Please sign in to comment.