Quote strings properly

This commit is contained in:
Trevor Vallender 2024-10-03 10:45:06 +01:00
parent 60cf058e04
commit cc3a3e668f
1 changed files with 9 additions and 8 deletions

View File

@ -7,20 +7,21 @@ if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
RATE_CHANGE_FACTOR=$1
IFS=" " read -r -a OPTS <<< $2
URL=${OPTS[0]}; METHOD=${OPTS[1]}; RATE=${OPTS[2]}; BODY=${OPTS[3]}
SLEEP_TIME=$(expr 60 / $RATE / $RATE_CHANGE_FACTOR)
SLEEP_TIME=$(perl -e "print 60.0 / $RATE / $RATE_CHANGE_FACTOR")
until false
do
curl --header "Content-Type: application/json" \
--data $BODY \
-X $METHOD \
-s $URL \
-o /dev/null
send_req () {
COMMAND="curl -X $METHOD --header 'Content-Type: application/json' --data '$BODY' -s '$URL' -o /dev/null"
eval $COMMAND
if [ $? -eq 0 ]
then
printf '%s' "."
else
printf '%s' "x"
fi
}
until false
do
send_req &
sleep $SLEEP_TIME
done