$ aspell dump master |sed -n $(echo $(($RANDOM % `aspell dump master|wc -l`)))p $ aspell dump master |sed -n $(echo $(($RANDOM % `aspell dump master|wc -l`)))p(Note: I'm mostly a Windows user nowadays and I have never personally used aspell, sed, or wc)
What does the p at the end of the line do? Is that a mistake or is it there on purpose?
sh -c 'cat /usr/share/dict/words |sed -n $(echo $(($RANDOM % `cat /usr/share/dict/words |wc -l`)))p'
I don't have aspell installed so 'cat /usr/share/dict/words' in place. sh -c 'cat /usr/share/dict/words | sed -n $(echo $((`cat /dev/urandom | od -N3 -An -i` % `cat /usr/share/dict/words | wc -l`)))p'
This is closer, although you might get sed: illegal option occasionally, I guess. I'm yet to learn how to generate a random number within given limits with bash. Oh wait, we can use Python can't we? sh -c 'cat /usr/share/dict/words | sed -n $(echo $((`python -c "import random; print random.randint(1,234935)"` % `cat /usr/share/dict/words | wc -l`)))p'