improved readabality
This commit is contained in:
+6
-4
@@ -2,11 +2,13 @@
|
||||
|
||||
SIZE=${1:-12}
|
||||
re='^[0-9]+$'
|
||||
if ! [[ $SIZE =~ $re ]] ;then
|
||||
echo "error: SIZE=$SIZE Not a number" >&2; exit 1
|
||||
if ! [[ $SIZE =~ $re ]]; then
|
||||
echo "error: SIZE=$SIZE Not a number" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ $SIZE -lt 4 || $SIZE -gt 20 ]]; then
|
||||
echo "expected SIZE=$SIZE not in range [4..20]" >&2; exit 1
|
||||
echo "expected SIZE=$SIZE not in range [4..20]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tr -cd '[:alnum:]' < /dev/urandom | fold -w $SIZE | head -n1
|
||||
tr -cd '[:alnum:]' </dev/urandom | fold -w "$SIZE" | head -n1
|
||||
|
||||
Reference in New Issue
Block a user