I run:
proc = subprocess.run(["echo", "$(echo 1111dGUv+rG551123eFwBhCMde6BIS90c3AAAAA= | base64 -d)"], check=True, stdout=subprocess.PIPE)
print(proc.stdout)
Got:
b'$(echo 1111dGUv+rG551123eFwBhCMde6BIS90c3AAAAA= | base64 -d)\n'
But wish to have $(echo 1111dGUv+rG551123eFwBhCMde6BIS90c3AAAAA= | base64 -d) executed and then passed to echo within a subprocess.run. So the result could be:
�]ute/����]v��p�u�!/tsp
How could this be achieved in subprocess.run() ?
>Solution :
Pass the shell=True argument to the subprocess.run() function, like this:
proc = subprocess.run('echo "$(echo 1111dGUv+rG551123eFwBhCMde6BIS90c3AAAAA= | base64 -d)"',
shell=True,
check=True,
stdout=subprocess.PIPE)
print(proc.stdout)