Posted By

ksaver on 04/20/11


Tagged

random passwords


Versions (?)

randpass.sh: Generate semi-aleatory passwords from command line.


 / Published in: Bash
 

Example:

$ randpass.sh 32

R"}I3$XzdsC0@KnjjA&U"M4$"lRLkIB@

$ for i in {1..10}; do randpass.sh; done

H,Cqby/2345UgyLWej5k

YV@{N{D<Tb<AtoqEa6t<

iz)!CL,y=(f/6!|3]8d=

Cjx09BT|?)W}_#q:KI(t

V](cO_1F]$Iq@h!2A"]]

PSO-2lp#>/FI=0DfSI]k

e?PrxzL_Q)ZcXr.YdOpr

ZLDU|x9kLmIcD-tEC9{t

|MD.VV)jck3B:9QR&mkG

1/bg&Iy?skZL9EMUxi3)

  1. #!/usr/bin/env bash
  2. # randpass.sh
  3. # Generate semi-aleatory passwords from command line.
  4. # Usage:
  5. # ./randpass.sh [NN]
  6. # "NN" is an optional positive integer.
  7. # Default length: 20
  8.  
  9. if [ -z "$1" ]
  10. then
  11. LEN=20
  12. else
  13. LEN=$1
  14. fi
  15.  
  16. echo $(< /dev/urandom tr -cd 'a-zA-Z0-9\<>!".$%&/()=?|@#[]{}-_.:,' \
  17. | head -c $LEN)

Report this snippet  

You need to login to post a comment.