aboutsummaryrefslogtreecommitdiff
path: root/bin/gen-password.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gen-password.sh')
-rwxr-xr-xbin/gen-password.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/gen-password.sh b/bin/gen-password.sh
new file mode 100755
index 0000000..52c35e5
--- /dev/null
+++ b/bin/gen-password.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+## SPDX-FileCopyrightText: 2022 M. Shulhan <ms@kilabit.info>
+## SPDX-License-Identifier: GPL-3.0-or-later
+
+## Script to generate random words from Indonesian directory of hunspell.
+
+DIC=/usr/share/hunspell/id_ID.dic
+KATA=(`cat ${DIC} | tail -n+13 | cut -d'/' -f1`)
+
+MAX=${#KATA[@]}
+RANDOM=$$
+export PASS=
+
+for x in 1 2 3 4; do
+ n=$((${RANDOM} % ${MAX}))
+ PASS="${PASS}${x}${KATA[n]}"
+done
+
+echo "Generated password is $PASS"