chiark / gitweb /
bugfixes to view-cyclicly
authorIan Jackson <ian@davenant.relativity.greenend.org.uk>
Sun, 19 Oct 2008 21:56:04 +0000 (22:56 +0100)
committerIan Jackson <ian@davenant.relativity.greenend.org.uk>
Sun, 19 Oct 2008 21:56:04 +0000 (22:56 +0100)
view-cyclicly

index 34e7087..01c0c4c 100755 (executable)
@@ -13,11 +13,16 @@ for f in "$@"; do
        g="${g//"/"/_:}"
        alt="${alt}_,$g"
 done
+tmp=".tmp$alt"
 
 ln -sf -- "$1" "$alt"
+
 "$viewer" "$alt" &
+trap "kill $!" 0
 
 while sleep 1.0; do
        justhad="$1"; shift; set -- "$@" "$justhad"
-       ln -sf -- "$1" "$alt"
+       ln -sf -- "$1" "$tmp"
+       mv -f "$tmp" "$alt"
+       echo "==== $1 ===="
 done