cs252/lab3-src-final/shell-tests/test_printenv

28 lines
532 B
Plaintext
Raw Permalink Normal View History

2018-10-25 14:45:56 -04:00
#!/bin/bash
rm -f csh-out shell-out
echo -e "\033[1;4;93mTest_printenv: Environment - Print Env Variables\033[0m"
echo "/usr/bin/printenv | grep PATH" > csh-in
#Make sure that printenv is a built in command
(
PATH=/bin
export PATH
echo "printenv | grep PATH" > shell-in
)
../shell < shell-in > shell-out
/bin/sh < csh-in > csh-out
sort shell-out -o shell-out
sort csh-out -o csh-out
diff shell-out csh-out
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