17 lines
331 B
Bash
Executable file
17 lines
331 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -euo pipefail
|
|
|
|
if [ "$#" = 0 ]; then
|
|
echo "Usage: $0 [passwords...] | $0 - < passwords.txt" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$1" = '-' ]; then
|
|
xargs -x -n1 -d'\n' htpasswd -bnBC 10 "" | tr -d ':' | sed '/^$/d'
|
|
else
|
|
for pass in "$@"; do
|
|
htpasswd -bnBC 10 "" "$pass" | tr -d ':' | sed '/^$/d'
|
|
done
|
|
fi
|
|
|