2018-12-09 RetConning your shell

posted Dec 9, 2018, 11:27 AM by Konstantinovich Samuel

Script to test your shells. 
As a way to keep my sanity and keep your grades high I propose the following:
a - I will give you all full/close to full credit on the shell assignment.
b - You will test and fix your shell -> So I won't have to grade so many broken shells
c - I will grade them again later, and hopefully not need to deduct points (But I will retroactively lower unfixed shells)

Here is a simple test script.
It runs some tests on bash
Then it runs those tests on your shell

P.S. - Extra output is not appreciated! Some people had multiple lines of whitespace/debug info after EVERY command
Your output should be VERY close to what bash looks like. 


This shell test file only requires make / make run, and no directory called ktests already created.
1. put it into a file called test.sh
2. Set permissions:
chmod +x test.sh
3. then execute the file
./test.sh

mkdir ktests
mkdir ktests/dir1
touch ktests/file1
touch ktests/file2
touch ktests/out
touch ktests/dir1/file3
cat > ./ktests/tests <<EOL
cd ktests
echo 1_THIS_IS_THE_START
echo 1_DIRECT_LS
ls -l
ls
echo _
echo _1_COMPLETED1_STARTING_2LSPIPEWC
ls | wc
echo _
echo _2_COMPLETED_STARTING_3LSREDIRECT
ls > out
cat out
echo _
echo _3_COMPLETED_STARTING4_REDIRECT_FILE_INTO_WC
wc < out
echo _
echo _4_COMPLETED_CHECKING_SUBDIR
cd dir1
ls
cd ..
ls
echo _
echo _5_THIS_IS_THE_END
exit
echo _
echo _THIS_SHOULD_NOT_PRINT______
EOL
echo _____________________
echo ___BASH_OUTPUT:___
echo _____________________
bash < ktests/tests
echo _____________________________
echo ___COMPARED_TO_YOURS:___
echo _____________________________
make
make run < ktests/tests
rm -rf ktests
Comments