We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ece339 commit ed62e36Copy full SHA for ed62e36
generate-random.sh
@@ -0,0 +1,10 @@
1
+#!/usr/bin/env bash
2
+set -e
3
+
4
+LENGTH=25
5
+if [ ! -z "$1" ] && [ $1 -gt 1 ]; then
6
+ LENGTH=$1
7
+fi
8
9
+# inspired by https://www.baeldung.com/linux/generate-random-string-using-random
10
+cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $LENGT | head -n 1
0 commit comments