commit d7994230c4b9c686e196144efc7443174bd0db59 parent e9dab5c2c7a9b8f06c52ae5c3f970b05cb69a4ed Author: gearsix <gearsix@tuta.io> Date: Sun, 28 Mar 2021 17:25:40 +0100 added randstr Diffstat:
A | src/randstr.sh | | | 9 | +++++++++ |
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/randstr.sh b/src/randstr.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# randstr +# description: generate a random string of size $1 (default: 10) +# e.g.$ randstr 10 + +len=10 +if [ $1 ]; then len=$1; fi + +echo $(cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w $len | head -n 1)