I have a shell script that calls a python script. The python script returns a variable "Found" back to the main shell. While I am able to display the result variable in main shell, the variable is not being recognized in conditions.
#!/bin/bash
PythonScript="C:\Users\arun\Test.py"
Pythonresult="$(py "${PythonScript}")"
Varuableresult="Found"
echo "Display both the results here..."
echo "Variable result is..." $Varuableresult
if [ "$Varuableresult" = 'Found' ]; then
echo "Variable result in condition working"
fi
echo "Python result is..." $Pythonresult
if [ "$Pythonresult" = 'Found' ]; then
echo "Python result in condition is working"
fi
The python script (Yes, it's just one line):
print("Found")
The output:
$ sh 'C:\Users\myusername\Documents\Value_Adds\FTP_Filecheck\Test.sh'
Display both the results here...
Variable result is... Found
Variable result in condition working
Python result is... Found
Why does the variable is not recognized in the condition?
I'm executing the shell script in Cygwin