Skip to content

Instantly share code, notes, and snippets.

@noqqe
Created February 13, 2011 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noqqe/824747 to your computer and use it in GitHub Desktop.
Save noqqe/824747 to your computer and use it in GitHub Desktop.
tiny yoda sentence generator
#!/bin/bash
WORDCOUNT="$#"
SENTENCE="$*"
NUMBER="0"
for x in $SENTENCE ; do
NUMBER=$(($RANDOM % $WORDCOUNT + 1))
while [ ! -z ${ARRAY[$NUMBER]} ]; do
NUMBER=$(($RANDOM % $WORDCOUNT + 1))
done
ARRAY[$NUMBER]=$x
done
echo ${ARRAY[*]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment