A sed wrapper for OSX/BSD courtesy of Flameeyes and Spanky
authorAlec Warner <antarus@gentoo.org>
Sat, 22 Apr 2006 20:08:55 +0000 (20:08 -0000)
committerAlec Warner <antarus@gentoo.org>
Sat, 22 Apr 2006 20:08:55 +0000 (20:08 -0000)
svn path=/main/trunk/; revision=3190

bin/sed [new file with mode: 0644]

diff --git a/bin/sed b/bin/sed
new file mode 100644 (file)
index 0000000..615bd1c
--- /dev/null
+++ b/bin/sed
@@ -0,0 +1,22 @@
+#!/bin/bash
+if [[ -n ${ESED} ]]; then
+exec ${ESED} "$@"
+elif type -p gsed > /dev/null ; then
+exec gsed "$@"
+else
+old_IFS="${IFS}"
+IFS=":"
+SEARCH=${PATH#*:}
+for path in $SEARCH; do
+if [[ -x $path/sed ]]; then
+exec $path/sed "$@"
+exit 0
+fi
+done
+IFS="${old_IFS}"
+fi
+exit 1