Migrate pwgen.py to bash

This commit is contained in:
2025-04-25 14:22:40 +08:00
parent 47afa44ed3
commit aece66a1d1
2 changed files with 14 additions and 32 deletions

View File

@@ -17,3 +17,17 @@ function kres {
kubectl get $1 -A $_O | grep "$_D*$2$_D*\s\+$_D*$3$_D*"
fi
}
function pwgen {
local _LEN=$1
case $_LEN in
''|*[!0-9]*)
echo "Enter a valid number" > /dev/stderr
return 1
;;
esac
LC_ALL=C tr -dc '[:graph:]' </dev/urandom | head -c $_LEN
if [ -t 1 ]; then
echo
fi
}