watchã³ãã³ããä½ã£ã¦ã¿ã
30åããã°ã©ã ããã®680ãwatchã³ãã³ããä½ã£ã¦ã¿ã¾ããã
watchã³ãã³ãã£ã¦ç¥ã£ã¦ãã¾ãã?
$ watch hogehoge
ã¨ããã¨ãä¸å®æéãã¨ã«hogehogeãå®è¡ãã¦ç»é¢ãæ´æ°ãã¦ãããã³ãã³ãã§ãã
watch dateã§æè¨å¤ããã«ããããwatch lsã§ãã¡ã¤ã«ãä½ãããæ§åãç£è¦ãããã¨ããªããªã便å©ã§ãã
ã¨ããããã§ããããä½ã£ã¦ã¿ã¾ãããã
ã½ã¼ã¹ã³ã¼ã
#! /usr/bin/python # -*- mode:python; coding:utf-8 -*- # # watch.py - # # Copyright(C) 2009 by mzp # Author: MIZUNO Hiroki / mzpppp at gmail dot com # http://howdyworld.org # # Timestamp: 2009/10/19 21:21:15 # # This program is free software; you can redistribute it and/or # modify it under MIT Lincence. # import subprocess import time import sys from curses import * def shell(cmds): return subprocess.Popen(cmds, stdout = subprocess.PIPE).communicate()[0] def watch(cmds): screen = initscr() noecho() while 1: screen.clear() screen.addstr(0,0,"Every 2.0s") screen.addstr(1,0,shell(cmds)) screen.refresh() time.sleep(2) watch(sys.argv[1:])