#!/bin/bash

cd $(dirname $0)

echo "Checking if CSH works"
rm -f env-csh.txt csh-test.csh

# FZK and some others had problems passing the test with a separate csh script:
# cat <<EOF > csh-test.csh
# #!/bin/csh
# env | sort > env-csh.txt
# EOF

/bin/csh -c "env|sort" > env-csh.txt

if [ "x$1" == "xdebug" ] ; then
   echo "CSH script generated the following output:"
   cat env-csh.txt
fi

if ( grep PATH env-csh.txt > /dev/null ) ; then
    echo "Test: OK."
    rm -f env-csh.txt csh-test.csh
    exit $SAME_OK
else
    echo "Test: ERROR."
    rm -f env-csh.txt csh-test.csh
    exit $SAME_ERROR
fi

