URI:
       mkpasswd - scripts - various script and utils
  HTML git clone git://z3bra.org/scripts
   DIR Log
   DIR Files
   DIR Refs
       ---
       mkpasswd (334B)
       ---
            1 #!/bin/sh
            2 
            3 len=16
            4 chars='a-zA-Z0-9*#!%@:;/&_'
            5 
            6 usage() {
            7         echo "usage: $(basename $0) [-c chars] [-l len]" >&2
            8 }
            9 
           10 while getopts "c:l:h" OPT; do
           11         case $OPT in
           12         c) chars="$OPTARG" ;;
           13         l) len="$OPTARG" ;;
           14         h) usage; exit 0 ;;
           15         *) usage; exit 1 ;;
           16         esac
           17 done
           18 shift $((OPTIND - 1))
           19 
           20 </dev/urandom tr -cd "$chars"|fold -w ${1:-$len}|sed 1q