Files
mastering-unix-ss/chapter2/function_build_random_line
Fabio Scotto di Santolo 4cc88d2f6e initial commit
2020-07-28 19:28:25 +02:00

20 lines
286 B
Plaintext
Executable File

build_random_line ()
{
# This function extracts random characters
# from the KEYS array by using the RANDOM
# shell variable
C=1
LINE=
until (( C > 79 ))
do
LINE="${LINE}${KEYS[$(($RANDOM % X + 1))]}"
(( C = C + 1 ))
done
# Return the line of random characters
echo "$LINE"
}