BreadCrumbs: Bash Random Word
Bash Random Word
From Luke Jackson
(Difference between revisions)
Revision as of 01:17, 4 November 2006 (edit) Ljackson (Talk | contribs) ← Previous diff |
Current revision (01:19, 4 November 2006) (edit) Ljackson (Talk | contribs) |
||
Line 1: | Line 1: | ||
+ | == Summary == | ||
+ | |||
+ | A simple script that returns a random word from the local dictionary file. | ||
+ | |||
== Supported Operating Systems == | == Supported Operating Systems == | ||
Current revision
Contents |
[edit]
Summary
A simple script that returns a random word from the local dictionary file.
[edit]
Supported Operating Systems
- Mac OS X and Terminal
- Unix
- Linux
[edit]
Requirements
- Perl or $RANDOM
- /usr/share/dict/words file
- alias
- Bash
[edit]
How To
Simply edit your .profile file in your ~/ (home) directory and add the line below.
alias word='sed `perl -e "print int rand(99999)"`"q;d" /usr/share/dict/words'
Next reload your shell and thats it!
Now the next time you log in you can type word and a random word from the dictionary file will be displayed.
[edit]
Usage
Now you ask what would I ever use this for?
That is simple silly, I like to use it when creating hundreds of directories on friends computers and watching them delete them with the mouse! HA HA
Something like this....
x=0 y=93 r=0 while [ "$x" -lt "$y" ] do # Do what $y says. r=`perl -e "print int rand(99999)"` # echo $r mkdir -v fun/`sed $r"q;d" /usr/share/dict/words` let "x = $x + 1" done
Also this could be quite handy when generating passwords for ssh accounts.
No more lame passwords for you...although it is a mass distributed dictionary file...hmmm ya lets just stick with pointless folder creation.