Is it possible to execute a Python program between backticks in a shell command?

Tyler

I'm trying to execute a Python program, redirect its output to a file, and compare the contents of that file to an existing one, all in a single shell command. This is what I have, but of course it's not working:

diff `python3 program.py > redirect_file.txt` compare_file.txt

I'm a Linux noob, so any help in pointing me in the right direction would be great.

Guntram Blohm

The diff command allows you to use a - on the command line to use stdin, so try:

python3 program.py | diff - compare_file.txt

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Is it possible to execute a Python program between backticks in a shell command?

From Dev

Is it possible to run a python program in the shell from the windows command prompt?

From Dev

Execute a shell script with ampersand from a python program

From Dev

how to execute a python program in a shell script

From Dev

Is it possible to execute a python script from a bash login shell with a one-line command from a non-login shell?

From Dev

how to execute the date command in a python program

From Dev

Execute shell command and retrieve stdout in Python

From Dev

Execute shell command from Python Script

From Dev

How is it possible to execute a command with an unknown number of arguments in a POSIX shell?

From Dev

Is it possible to run a python command within a shell script?

From Dev

How to execute python program in python shell in Linux importing a special environment

From Dev

How to execute python program in python shell in Linux importing a special environment

From Dev

execute shell command with tcl

From Dev

Execute a shell command

From Dev

Execute shell command with nodejs

From Dev

Execute CMD command with Shell

From Dev

How to make 'python' program command execute Python 3?

From Dev

How to make 'python' program command execute Python 3?

From Dev

Is it possible for a program to get number of spaces between command line arguments in POSIX?

From Dev

How to execute python program using a shell script (and makefile?)

From Dev

syntax error while trying to execute python program in bash shell

From Dev

Shell Script: execute & repeat a python program that needs extra input

From Dev

Execute command on shell command output

From Dev

Why does my shell command with nested backticks fail?

From Dev

How to execute a program or call a system command from Python?

From Dev

How can I execute an os/shell command from python

From Dev

How can I execute an os/shell command from python

From Dev

How does a shell execute a program?

From Dev

Is it possible to run/execute a bash script command from inside a python code?

Related Related

  1. 1

    Is it possible to execute a Python program between backticks in a shell command?

  2. 2

    Is it possible to run a python program in the shell from the windows command prompt?

  3. 3

    Execute a shell script with ampersand from a python program

  4. 4

    how to execute a python program in a shell script

  5. 5

    Is it possible to execute a python script from a bash login shell with a one-line command from a non-login shell?

  6. 6

    how to execute the date command in a python program

  7. 7

    Execute shell command and retrieve stdout in Python

  8. 8

    Execute shell command from Python Script

  9. 9

    How is it possible to execute a command with an unknown number of arguments in a POSIX shell?

  10. 10

    Is it possible to run a python command within a shell script?

  11. 11

    How to execute python program in python shell in Linux importing a special environment

  12. 12

    How to execute python program in python shell in Linux importing a special environment

  13. 13

    execute shell command with tcl

  14. 14

    Execute a shell command

  15. 15

    Execute shell command with nodejs

  16. 16

    Execute CMD command with Shell

  17. 17

    How to make 'python' program command execute Python 3?

  18. 18

    How to make 'python' program command execute Python 3?

  19. 19

    Is it possible for a program to get number of spaces between command line arguments in POSIX?

  20. 20

    How to execute python program using a shell script (and makefile?)

  21. 21

    syntax error while trying to execute python program in bash shell

  22. 22

    Shell Script: execute & repeat a python program that needs extra input

  23. 23

    Execute command on shell command output

  24. 24

    Why does my shell command with nested backticks fail?

  25. 25

    How to execute a program or call a system command from Python?

  26. 26

    How can I execute an os/shell command from python

  27. 27

    How can I execute an os/shell command from python

  28. 28

    How does a shell execute a program?

  29. 29

    Is it possible to run/execute a bash script command from inside a python code?

HotTag

Archive