/ Published in: Bash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash w="$1" [[ -n "$w" ]] || w=12 if [[ $w -lt 8 ]]; then echo "A password of length $w would be too weak." exit 1 fi passwd=$( cat /dev/urandom |tr -dc "a-zA-Z0-9_\?\$\#\." |fold -w $w |head -1 ) echo "${passwd}"