Quote strings properly
This commit is contained in:
parent
60cf058e04
commit
cc3a3e668f
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue