生成包含隨機字符串的文件的腳本

  1. #!/bin/sh  
  2. #sh make_random_strings 16 10000  
  3. #make 10000 strings, the string length:16  
  4.   
  5. for((j=0; j<$2; j++))  
  6. {  
  7.         str=  
  8.         for((i=0; i<$1; i++))  
  9.         {  
  10.                 one=`cat /dev/urandom |strings -n 1 | cut -c-1| head -1`  
  11.                 str=${str}${one}  
  12.         }  
  13.   
  14.         echo $str  
  15. }  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章