1.

Solve : Convert shell script to python?

Answer»

I have written a shell script and I need the same script in PYTHON to execute it for windows.

Code: [Select]#!/usr/bin/env bash

sonar_token=$1
sonar_server=$2
sonar_project_key=$3


echo "Fetching the Sonar Quality gate status using api"
quality_gatesstatus=$(curl -u $sonar_token: https://$sonar_server/api/qualitygates/project_status?pullRequest=$PullRequestId | grep -Po '"status": *\K"[^"]*"')

echo "the Sonar quality gates for current analysis is: $quality_gatesstatus"
if ("$quality_gatesstatus" != "OK") && ("$quality_gatesstatus" != "NONE")
then
echo "Check Sonar server and fix the issues"
echo $quality_gatesstatus
exit 1
else
echo "No code violations found"
exit 0
fi
I am trying but i am failing to do that, please help us on that.The problem is you are calling is a shell script. You to tell use it is bash and what version of bash.
Here is a possible answer:
https://stackoverflow.com/questions/2839810/converting-a-bash-script-to-python-small-script

Sorry I can not do it. I am GETTING too OLD.



Discussion

No Comment Found