Last active
August 29, 2015 14:10
-
-
Save vindolin/476b946e5953401a7d70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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