I have a simple shell file that has this:
#! /bin/bash
echo "Hello"
echo "Full Name: $1";
echo "Age: $2";
I am calling this file from the python jupyter notebook like this:
import subprocess
filePath = 'testScript.sh'
arg1 = 'John Doe'
arg2 = 2
subprocess.run([filePath, arg1, str(arg2)], shell=True, check=True)
The file runs fine and I get this output:
CompletedProcess(args=['testScript.sh', 'John Doe', '2'], returncode=0)
While the code is running, it pops open a command line window and the output flashes for a second before the window closes. I was wondering is there a way to print output into python rather than only seeing the output in the command line window? Or is there a way to prevent the command line window from closing so I can see the output?