I want to execute a command and then log its output to a log file using logging.info
I am currently using
cmd = """var=$(cat ip.txt | head -1 | sed 's/[^|]//g' | awk '{ print length }')"""
logging.info(cmd)
process = os.popen(cmd)
processClose = process.close()
logging.info($var)
but it gives me an error as $ is an invalid syntax.
I want the output in the log file to print the value of the variable (var)