about summary refs log tree commit diff stats
path: root/samples/keepviewer
diff options
context:
space:
mode:
Diffstat (limited to 'samples/keepviewer')
-rwxr-xr-xsamples/keepviewer15
1 files changed, 10 insertions, 5 deletions
diff --git a/samples/keepviewer b/samples/keepviewer
index 92e8f768..f5c0b2c1 100755
--- a/samples/keepviewer
+++ b/samples/keepviewer
@@ -8,8 +8,13 @@
 # Parameters:
 #	$1 is viewer
 #	$2 is filename
-chmod 600 $2
-myfile=`echo $2 | sed -e 's@\(.*/tmp/\)\([^/]*/\)\?\(.*\)@\1my\3@'`
-ln $2 $myfile || exit 1
-trap "rm -f $myfile" 0 1 2 5 15
-eval $1 $myfile
+if test $# = 2 ; then
+	chmod 600 $2
+	myfile=`echo $2 | sed -e 's@\(.*/tmp/\)\([^/]*/\)\?\(.*\)@\1my\3@'`
+	ln $2 $myfile || exit 1
+	trap "rm -f $myfile" 0 1 2 5 15
+	eval $1 $myfile
+else
+	echo "Usage: keepviewer <viewer> <filename>"
+	exit 1
+fi