July 2018
Beginner
264 pages
8h 9m
English
Open a terminal and create a new script called data-maker.sh.
The following is the code snippet of the script:
#!/bin/bashN_FILES=3TYPE=binaryDIRECTORY="qa-data"NAME="garbage"EXT=".bin"UNIT="M"RANDOM=$$TMP_FILE="/tmp/tmp.datamaker.sh"function get_random_number() { SEED=$(($(date +%s%N)/100000)) RANDOM=$SEED # Sleep is needed to make sure that the next time rnadom is ran, everything is good. sleep 3 local STEP=$1 local VARIANCE=$2 local UPPER=$3 local LOWER=$VARIANCE local ARR; INC=0 for N in $( seq ${LOWER} ${STEP} ${UPPER} ); do ARR[$INC]=$N INC=$(($INC+1)) done RAND=$[$RANDOM % ${#ARR[@]}] echo $RAND}
Let's begin the execution of the script using the following command. It uses the -t flag for type and is set to text ...
Read now
Unlock full access