Skip to content

Instantly share code, notes, and snippets.

@rafaelrinaldi
Created March 29, 2011 22:23
Show Gist options
  • Save rafaelrinaldi/893478 to your computer and use it in GitHub Desktop.
Save rafaelrinaldi/893478 to your computer and use it in GitHub Desktop.
Return a string with a random numeric value and you can specify the length.
random() {
value=$RANDOM
length=$1
if [[ ! $length ]]; then
length=5
fi
echo ${value:0:$length}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment