MIAOU-BASH is a collection of scripts and configurations designed to enhance your terminal experience. As the name suggests, it is built on Bash and is designed to work on most modern GNU/Linux systems.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
294 B

#!/bin/bash
SIZE=${1:-12}
re='^[0-9]+$'
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
fi
tr -cd '[:alnum:]' < /dev/urandom | fold -w $SIZE | head -n1