import fcntl | |
import termios | |
import sys | |
fd = sys.stdin.fileno() | |
old = termios.tcgetattr(fd) | |
new = termios.tcgetattr(fd) | |
new[3] = new[3] & ~termios.ECHO # disable echo | |
termios.tcsetattr(fd, termios.TCSANOW, new) | |
fcntl.ioctl(fd, termios.TIOCSTI, '\021') # ^Q quote control characters | |
command = 'df -h' | |
for c in command: | |
fcntl.ioctl(fd, termios.TIOCSTI, c) | |
termios.tcsetattr(fd, termios.TCSANOW, old) # restore settings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment