Basic Spelling Game With Bash & Aspell On Linux Mint Example

Go down

Basic Spelling Game With Bash & Aspell On Linux Mint Example

Post by jamied_uk on 9th June 2018, 21:34





Code:
#!/bin/bash
#
clear
echo "Welcome to the Spelling Game"
aspell check file.txt
# now compare the md5 sum of file with compare file aka file.txt.bak answer file made on 1st use with new players to show if level complete!
#
# now
# Show Resaults!
#
echo ""
#
diff -q file.txt afile.txt 1>/dev/null
if [[ $? == "0" ]]
then
    echo "Correct You Passed!"
    # cleanup here!
    cp file.txt.bak file.txt
else
    echo "You Failed, Try Again!"
    # cleanup here!
    cp file.txt.bak file.txt
fi
#
# Another way would be to use md5sum to check size and that way you don’t have an answer file where cheating could take place
#

Level 2

avatar
jamied_uk
Admin

Posts : 2442
Join date : 2010-05-09
Age : 36
Location : UK

http://address-shortner.co.uk

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum