Shell Version #1
Comments on this implementation:
- uses
tr to split input stream into "words" (space-separated)
- stores prefixes and suffixes in a file called
suffixes of the form
prefixWord1 prefixWord2 suffixWord
...
|
- this file is built by simply appending 3-word phrases
- thus, prefixes may be repeated throughout the file
- uses
grep to do the lookup work (find all lines for given prefix)
- uses
`..` and sed to combine suffixes into list of words
- uses
shift to choose a random element from this list
|