Advertisement
pouar

randtext

Apr 10th, 2016
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.26 KB | None | 0 0
  1. rand()
  2. {
  3.     echo $(( $(cat /dev/urandom|od -vAn -N2 -tu2|tr -d '[:blank:]') % $1 ))
  4. }
  5.  
  6. randtext()
  7. {
  8.         a=( "$@" )
  9.         echo "${a[$(rand $#)]}"
  10. }
  11.  
  12. randtext "text 1" "text 2" "text 3" "text 4" # will print either "text 1", "text 2", "text 3", or "text 4" at random
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement