Run BASH built-in commands in Python?
bash, command, python, subprocess
Solution
I finally found a solution that works.
from subprocess import Popen, PIPE, STDOUT
shell_command = 'bash -i -c "history -r; history"'
event = Popen(shell_command, shell=True, stdin=PIPE, stdout=PIPE,
stderr=STDOUT)
output = event.communicate()
Thank you everyone for the input.
Problem
Is there a way to run the BASH built-in commands from Python? I tried: ``` subprocess.Popen(['bash','history'],shell=True, stdout=PIPE) subprocess.Popen('history', shell=True, executable = "/bin/bash", stdout=subprocess.PIPE) os.system('history') ``` and many variations thereof. I would like to run `history` or `fc -ln`.