I need to execute my python program from shell script so that the print commands in my python program will be exposed for reading from another program. the shell script:
#!/bin/bash
if [ $# -lt 1 ] || [ $# -gt 2 ];then
echo "Usage: $0 APK <duration in seconds>"
exit 1;
fi
printf "$(python '/root/Desktop/DroidBox_4.1.1/scripts/droidbox.py' $1 $2 -c 'import sys; exec sys.stdin.read()')"
My python program should get the parametrs $1 and $2 but it doesn't recognize those as parametrs but taking -c and the command after it as the parametrs.
For answers like: getting the process input stream in my other project won't work for me. the only way that seems to be working is to use -c option and the command 'exec sys.stdin.read()'.
thank you.
droidbox.pylook like? If youprint(sys.argv)in that script, what does it display?printf "%s" "$( python ...Then, what input should it read, the stdin of the shell script? Also, as test, you might assign variables from $1 and $2 and then use the variable names on the call to droidbox.py to avoid someone mangling with the position parameters.