Create A Crossword Solver 2

Terminal

Share
Create A Crossword Solver

Hey

This tip was passed onto me, so I decided to share it here. This very small Unix script is designed to solve crossword puzzles. For a person like myself who can’t think of words any longer  than four letters (scrabble is a no hope) this little script is very useful if you want to show off or actually complete a crossword. This script will check the Unix database of words and give you possible solutions.

To set up this script is dead simple. Open up TextEdit and copy and paste the following. Name it something simple and in a folder you can easily find.

#!/bin/bash

echo -n "Please enter a word pattern to search for (use a . for unknowns): "
read text

echo `grep -w $text /usr/share/dict/words`

Save this file as xxx.sh. The sh bit is very important.

Next open up Terminal and type the following.

chmod +x xxx.sh

This will make the sh file an executable and ready for use.

The final step is to actually use it. In Terminal again, type the following:

/path/to/xxx.sh

The script will then run. You now have to enter the word you want to be searched. On the command line, type all of the letters you know, and replace any you don’t with dots (.). Hit enter once again and it will display all of the words it has found. Hopefully it will find ones that match. As mentioned the dictionary Unix uses isn’t as large as the built in one for Apple’s app Dictionary, but it will do most of the time.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips