kumquat-buildroot/toolchain/dependencies/check-host-sed.sh
Bernhard Reutner-Fischer 9c5b374d8d - fix syntax
2007-03-12 08:55:20 +00:00

33 lines
555 B
Bash
Executable File

SEDLIST="/usr/bin/sed /bin/sed sed gnused gsed"
for SED in $SEDLIST
do
if ! test -x $SED ; then
SED=$(which $SED)
if ! test -x "$SED" > /dev/null ; then
SED=""
continue
fi
fi
echo "HELLO" > .sedtest
$SED -i -e "s/HELLO/GOODBYE/" .sedtest >/dev/null 2>&1
RESULT=$(cat .sedtest)
if test $? != 0 ; then
SED=""
elif test -e ".sedtest-e" ; then
rm -f ".sedtest-e"
SED=""
elif [ "x$RESULT" = "x" ] || [ "$RESULT" != "GOODBYE" ] > /dev/null ;
then
SED=""
fi
rm -f .sedtest
if [ ! -z "$SED" ] ; then
break
fi
done
echo $SED