diff options
author | Alec Warner <antarus@gentoo.org> | 2006-04-23 15:55:13 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2006-04-23 15:55:13 +0000 |
commit | 3fc1cef8987a842b62e525f61fb24c0384861cc2 (patch) | |
tree | 89f7ecb03308c3f8e13c0bf8a93a9098366226ea | |
parent | fa0158584a99e64dabe534f81c266dd8b6ca5c41 (diff) | |
download | portage-3fc1cef8987a842b62e525f61fb24c0384861cc2.tar.gz portage-3fc1cef8987a842b62e525f61fb24c0384861cc2.tar.bz2 portage-3fc1cef8987a842b62e525f61fb24c0384861cc2.zip |
Fix sed breakage for people with weird PATH, fix tabs. Thanks to Flameeyes once again.
svn path=/main/trunk/; revision=3199
-rwxr-xr-x | bin/sed | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -2,23 +2,25 @@ # Copyright 2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +scriptpath=$_ + if [[ -n ${ESED} ]]; then -exec ${ESED} "$@" + exec ${ESED} "$@" elif type -p gsed > /dev/null ; then -exec gsed "$@" + exec gsed "$@" else -old_IFS="${IFS}" -IFS=":" + 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}" + for path in $PATH; do + [[ ${path}/sed == $scriptpath ]] && continue + if [[ -x $path/sed ]]; then + exec $path/sed "$@" + exit 0 + fi + done + + IFS="${old_IFS}" fi exit 1 |