Advertisement
metalx1000

BASH Word Scramble

Aug 19th, 2018
948
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.18 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function scramble(){
  4.   local s=$* i
  5.   while((${#s})); do
  6.     ((i=RANDOM%${#s}))
  7.     echo -n "${s:i:1}"
  8.     s=${s::i}${s:i+1}
  9.   done
  10. }
  11.  
  12. scramble This is a test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement