scripts

shell scripts
git clone git://git.bitsmanent.org/scripts
Log | Files | Refs | README

diffmon (335B)


      1 #!/bin/sh
      2 # Monitor a file and show changed lines.
      3 
      4 file="$1"
      5 
      6 if [ -z "$1" ]; then
      7 	echo "Usage: $0 <file>"
      8 	exit 1
      9 fi
     10 
     11 copy="$(mktemp -u /tmp/rummage.XXXXX)"
     12 cp "$file" "$copy"
     13 
     14 trap "rm -f '$copy'; exit 1" EXIT INT TERM HUP # cleanup
     15 watch diff --old-line-format='' --new-line-format='%L' --unchanged-line-format='' "$copy" "$file"