1 2 3 4
#!/bin/sh # generates a password of length $1. PW=$(tr -cd "[:alnum:][:punct:]"</dev/urandom|fold -w "$1"|head -1) printf '%s\n' "$PW"