I am quite new to bash scripts. How do I execute the below command to capture the time to execute the command.
I have my deals captured in an array variable. I then am looping through the deals to execute a TradeService remote call. I want to capture the time for this call and aggregate it across all the deals.
- What is the best way to execute this call and capture the time within my script
- How do I manage time in my script, post aggregation of time I want to show it in hours/minutes/seconds.
#!/bin/bash
DEALS="1739719, 1714630, 1733697, 1723940, 1666257, 1665239"
IFS=', ' read -ra array <<< "$DEALS"
for i in "${array[@]}"
do
echo "Executing for DEALS $i"
RUN_TIME = time echo -n '{"source_system": "PROGA", "deal_id": $array[$i], "as_of": "2019-14-01T23:59:00Z"}' | java -jar ~/support/lib/polyglot.jar --command=call --endpoint=trades-server:10443 --full_method='TradeService/GetDeals' > /dev/null
echo "Runtime is $RUN_TIME"
done