On Mon, 7 Oct 2002, Scott Prive wrote:

> Is anyone aware of a port of "watch" to Cygwin?
>
> For the curious, watch is a standard (?) tool on Linux which re-executes
> a command at 2 second intervals (configurable).
> ex: watch "ls -l"
> This is more convenient than looping code on the shell.
>
> On Linux, this is part of procps:
> [root@redhat root]# rpm --whatprovides -q `which watch`
> procps-2.0.7-21
>
> Thanks,
> Scott

Scott,

There is a procps package available for Cygwin...
If you don't want to install the whole package, use the attached script
(which took about 15 minutes to write) for similar functionality (minus
difference highlighting).
        Igor
-- 
                                http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_                [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_            [EMAIL PROTECTED]
     |,4-  ) )-,_. ,\ (  `'-'           Igor Pechtchanski
    '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51
#!/bin/sh
#
# watch - a script similar to the watch program from the procps package
# Created by Igor Pechtchanski <[EMAIL PROTECTED]>   10/07/2002
# $Revision: 0.1$

VERSION='$Revision: 0.1$'
ME="`basename $0`"
USAGE="Usage: $ME [-hnv] [--help] [--interval=<n>] [--version] <command>"
USAGEVERBOSE="\
  -h, --help                            print a summary of the options
  -n, --interval=<seconds>              seconds to wait between updates
  -v, --version                         print the version number"

INT=2
case "$1" in
  -n) INT=$2; shift; shift ;;
  --interval=*) INT=${1##--interval=}; shift ;;
  -v | --version) echo "$VERSION" | sed 's/^\$.*: \(.*\)\$$/\1/'; exit 0 ;;
  -h | --help) echo "$USAGE"; echo "$USAGEVERBOSE"; exit 0 ;;
  --) shift; break ;;
  --*) echo "$ME: unknown option -- ${1##--}" >&2; echo "$USAGE" >&2; exit 1 ;;
  -*) echo "$ME: unknown option -- ${1##-}" >&2; echo "$USAGE" >&2; exit 1 ;;
  *) break ;;
esac
if [ "$*" = "" ]; then
  echo "$USAGE" >&2
  exit 1
fi
while true; do
  eval "$@"
  sleep $INT
done

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to