annotate bin/pwgen @ 720:2cfa6fb4e755

Filetype for samba config
author nanaya <me@nanaya.net>
date Mon, 19 Aug 2024 16:52:59 +0900
parents bdc9eddf3743
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
651
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
1 #!/bin/sh
478
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
2
651
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
3 set -e
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
4 set -u
478
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
5
651
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
6 _length="${1:-12}"
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
7
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
8 for i in 1 2 3 4 5; do
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
9 printf "%s: " "$i"
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
10 openssl rand -base64 "$_length" | tr '/+' '-_' | cut -c "1-$_length"
bdc9eddf3743 [pwgen] rewrite in shell script
nanaya <me@nanaya.pro>
parents: 495
diff changeset
11 done