Generate a random string with just bash Adding options to add newlines, choose lowercase or uppercase or both is trivial rand_string() { local c=0 while [ $c -lt $1 ]; do printf "\x$(printf '%x' $((97+RANDOM%25)))" c=$((c+1)) done }