Sub-process in Python execute two task? [closed]

To run nmap in a new xterm window, you could use -e option:

#!/usr/bin/env python
import subprocess

subprocess.Popen(['xterm', '-e', 'bash -c "sudo nmap -v -sS -O 10.2.2.2; read"'])

read is appended to wait for Enter after nmap exits before closing the window.

Leave a Comment