aboutsummaryrefslogtreecommitdiff
path: root/bin/gen-password.sh
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-11-11 00:14:37 +0700
committerShulhan <ms@kilabit.info>2024-11-11 00:21:59 +0700
commitbc89bb8018ebd93f1327ca48a49369b93d37b5f8 (patch)
treeebb9ebff07d3dc14464af941db8be08e52bda30c /bin/gen-password.sh
parent8852c6b37fe14e3cf723704f6e28dc88621b51b6 (diff)
downloadbin.sh-bc89bb8018ebd93f1327ca48a49369b93d37b5f8.tar.xz
bin: add script "gen-password.sh"
The gen-password.sh is shell script to generate random words from Indonesian directory of hunspell. The hunspell-id package can be installed from AUR: https://aur.archlinux.org/packages/hunspell-id-git
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"