Дана 26/02/21 11:47AM, Crystal Kolipe написа:
> > while :; do
> > for i in $(dd if=/dev/random bs=4 count=1 2>/dev/null |
> > hexdump -e '/1 "%u\n"')
>
> Do you think that this is guaranteed to print four decimal numbers to stdout,
> one per line?
>
> Bad assumption. Test this:
>
> $ echo -n '0000' | hexdump -e '/1 "%u\n"'
>
> Hexdump replaces duplicated lines with '*' by default.
In my own alias for password generation, I use tr to filter characters
that I want, and remove visually potentially ambiguous characters:
alias passgen="{ tr -dc A-Za-z0-9\$\#@^:\._- </dev/urandom | \
tr -d Oo0Il1 | \
dd bs=1 count=15 status=none; echo; }"
There's no need for hexdump(1) (or od(1), or xxd(1), etc) at all.