cs252/lab3-src-final/test-shell/test9
2018-10-25 14:45:56 -04:00

17 lines
426 B
Bash
Executable File

#!/bin/bash
rm -f err1 err2 csh-out shell-out
echo -e "\033[1;4;93mTest9: Pipes and error redirection\033[0m"
echo "cat file1.cc | ls nonexisting >& err1" > shell-in
echo "cat file1.cc | ls nonexisting > err2 2>&1" > csh-in
/bin/sh < csh-in > csh-out 2>&1
../shell < shell-in > shell-out 2>&1
diff err1 err2
if [ $? -ne 0 ]
then
echo -e "\033[1;31m$0 Failed\033[0m"
exit -1
fi
echo -e "\033[1;32m$0 Passed\033[0m"
exit 0