Reputation: 14102
I'm using sh
module in Python3.
I'd like to see the final command string that is being issued to the shell.
The answer seems be related to this, but I'd like to see the command before executing it.
Is this possible? How can I do this?
Upvotes: 1
Views: 177
Reputation: 14102
It was easier than expected.
To print the constructed command, you can do:
print(sh.echo.YOURCOMMAND)
Or better still:
my_command = sh.my_command.bake(['my', 'options'])
# print my_command as a string
print(my_command)
# execute my_command
my_command()
sh
is great !
Upvotes: 1