|October 21, 2015|
As a tester, I sometimes have a need for a random word. For example, I may need a unique word for creating a new account in my system. Using the Shell Script feature in TextExpander now makes it easy to add a random word whenever I need to.
Here are the simple steps to create a TextExpander Snippet so that you can instantly insert a random word whenever you need it:
lines=$(cat $WORDFILE | wc -l);
sed -n "$rnum p" $WORDFILE | perl -pe 'chomp'
The root dictionary, /usr/share/dict/words as my random source library is good choice since their are 235,886 words available.
There are many ways to get a random word, I selected using the above method since it seems to be the quickest way. If you know of a better option, let me know!
Feel free to leave a comment about this post.