I'm using subprocess.run
to run a command that has a for loop in it but not getting back the expected result. Here's a simplified case that shows the issue.
In bash shell:
for i in {1..3}; do echo ${i}; done
The result is:
1
2
3
Which is what I expect and want. However in my code when I execute this following:
subprocess.run("for i in {1..3}; do echo ${i}; done", shell=True, check=True)
the result printed on my shell is {1..3}
But what I want the result to be is:
1
2
3
like when I execute the code in my shell. Would appreciate any insights on how to fix this, thanks!