1

Print a random string or select random elements - Comments

view story
linux-howto

http://wiki.bash-hackers.org – First off, here is a fast / reliable random string function for scripts or libraries which can optionally assign directly to a variable. # Print or assign a random alphanumeric string of a given length. # rndstr [ -v var ] len # Bash-only rndstr() if [[ $FUNCNAME == "${FUNCNAME[1]}" ]]; then # On recursion, this branch unsets the outer scope's locals and assigns the result. unset -v a b printf -v "$1" %s "${@:2}" elif ! { [[ $1 == -v ]] && shift; }; [[ $?+1 -ne… (HowTos)