[MLton-commit] r5944

Matthew Fluet fluet at mlton.org
Fri Aug 24 15:20:17 PDT 2007


'head' on MacOSX doesn't support negative line count; fake it with 'wc' and shell arithmetic
----------------------------------------------------------------------

U   mlton/trunk/bin/grab-wiki
U   mlton/trunk/bin/sync-ignore

----------------------------------------------------------------------

Modified: mlton/trunk/bin/grab-wiki
===================================================================
--- mlton/trunk/bin/grab-wiki	2007-08-24 21:41:16 UTC (rev 5943)
+++ mlton/trunk/bin/grab-wiki	2007-08-24 22:20:16 UTC (rev 5944)
@@ -96,7 +96,9 @@
 
 for f in $(cat "$index"); do
 	echo "$f"
-	head -n -19 <"$f" >"$tmp"
+        l=`wc -l < "$f"`
+        let l-=19
+	head -n $l <"$f" >"$tmp"
 	(
 		"$bin/msed" -f "$script" <"$tmp"
 		echo '</body></html>'

Modified: mlton/trunk/bin/sync-ignore
===================================================================
--- mlton/trunk/bin/sync-ignore	2007-08-24 21:41:16 UTC (rev 5943)
+++ mlton/trunk/bin/sync-ignore	2007-08-24 22:20:16 UTC (rev 5944)
@@ -28,8 +28,15 @@
 for i in `find "$root" -type f -name .ignore`; do
         d=`dirname "$i"`
         tmp='/tmp/z.ign'
-        svn propget "$p" "$d" | head -n -1 >"$tmp"
+        l=`svn propget "$p" "$d" | wc -l`
+        let l-=1
+        if [ $l -ge 0 ]; then
+                svn propget "$p" "$d" | head -n $l >"$tmp"
+        else
+                svn propget "$p" "$d" >"$tmp"
+        fi
         if ! diff -q "$i" "$tmp" >/dev/null; then
                 svn propset "$p" -F "$i" "$d"
         fi
+        rm $tmp
 done




More information about the MLton-commit mailing list