Below is the output command when i execute im getting multiple line.
My question is that i should want to have multiple line instead of that a single line is need in script
Output command:- bash script.sh --username USERNAME --password PASSWORD --project "Test Project"
oxNjM5ODA2MTg5fQ.ea82ZkR5afv5uT0m6l8ttutOWCelPlxuyr4iU3VkZyU
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9617 0 9617 0 0 7166 0 --:--:-- 0:00:01 --:--:-- 7160
runId = 8a8094017dbc2780017dc6ea6a3c0780
taskStatus = WAITING
Checking Status....
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9725 0 9725 0 0 7209 0 --:--:-- 0:00:01 --:--:-- 7214
Status = PROCESSING Success Percent = 100.0 Total Tests = 75 Total Failed = 0 Run = 16
Checking Status....
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9725 0 9725 0 0 7155 0 --:--:-- 0:00:01 --:--:-- 7155
Status = PROCESSING Success Percent = 100.0 Total Tests = 75 Total Failed = 0 Run = 16
Checking Status....
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9862 0 9862 0 0 7465 0 --:--:-- 0:00:01 --:--:-- 7465
Status = PROCESSING Success Percent = 93.0 Total Tests = 75 Total Failed = 5 Run = 16
Checking Status....
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9862 0 9862 0 0 7493 0 --:--:-- 0:00:01 --:--:-- 7493
Status = PROCESSING Success Percent = 93.0 Total Tests = 75 Total Failed = 5 Run = 16
Checking Status....
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9886 0 9886 0 0 7517 0 --:--:-- 0:00:01 --:--:-- 7517
Status = COMPLETED Success Percent = 90.0 Total Tests = 75 Total Failed = 7 Run = 16
And Here is my shellscript
#!/bin/bash
# Begin
TEMP=$(getopt -n "$0" -a -l "username:,password:" -- -- "$@")
[ $? -eq 0 ] || exit
eval set -- "$TEMP"
while [ $# -gt 0 ]
do
case "$1" in
--username) TS_USER="$2"; shift;;
--password) TS_PWD="$2"; shift;;
--) shift;;
esac
shift;
done
curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${TS_USER}'", "password": "'${TS_PWD}'"}' https://example.com/login
echo "generated token is:" $token
curl --location --request POST "https://example.com/" --header "Authorization: Bearer "$token""
echo "runId =" $runId
if [ -z "$runId" ]
then
echo "RunId = " "$runId"
echo "Invalid runid"
echo $(curl --location --request POST "https://example.com/" --header "Authorization: Bearer "$token"")
exit 1
fi
taskStatus="WAITING"
echo "taskStatus = " $taskStatus
while [ "$taskStatus" == "WAITING" -o "$taskStatus" == "PROCESSING" ]
do
sleep 5
echo "Checking Status...."
passPercent=$(curl --location --request GET "https://example.com/" --header "Authorization: Bearer "$token"")
taskStatus="${array[0]}"
echo "Status =" "${array[0]}" " Success Percent =" "${array[1]}" " Total Tests =" "${array[2]}" " Total Failed =" "${array[3]}"
if [ "$taskStatus" == "COMPLETED" ];then
echo "------------------------------------------------"
echo "Run detail link https://example.com${array[7]}"
echo "-----------------------------------------------"
echo "Job run successfully completed"
exit 0
fi
done
echo "Task Status = " $taskStatus
exit 1
fi
echo "$(curl --location --request GET "https://example.com/" --header "Authorization: Bearer "$token"")"
exit 1
return 0
Just want single line what i need to add in above script so that it should show only one line i.e, Status.... Status = COMPLETED Success Percent = 90.0 Total Tests = 75 Total Failed = 7 Run = 16