Created
April 4, 2015 14:45
-
-
Save wh13371/11584e449738b324a98d to your computer and use it in GitHub Desktop.
linux = python clip
This file contains hidden or 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
#! /usr/bin/python | |
from gtk import Clipboard | |
import sys | |
def clip_in(text): | |
cb = Clipboard() | |
cb.set_text(text) | |
cb.store() | |
def clip_out(): | |
clip = Clipboard() | |
return clip.wait_for_text() | |
def main(): | |
if not sys.stdin.isatty(): | |
data = sys.stdin.read().strip() | |
clip_in(data) | |
else: | |
print clip_out() | |
main() |
hi sir i want to know everything in python pls. here in linux
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
write to clipboard
uptime | clip
cat moo.txt | clip
read from clipboard
clip
clip > moo.txt