I have a python script in which I need to invoke a shell command. The shell command can accept its input from either a file or stdin.
In my script, the input is stored in a variable. What is the proper way to invoke the command? If it matters, the shell command produces no output.
I know I could write the variable's content into a file and invoke the command with the file as argument but that seems inelegant. Surely, there's a better way.
Can someone tell me what it is? Thanks.