I've just found out that my the value returned by 'which' doesn't reflect 
whether it found a file or not. My shell scripts that use this test are, 
therefore, flawed. Instead, I should be using 'type'

Patch attached. Ok?

I've also found out that I can pass variables to a shell function, but that 
clean-up can wait for another day...

-- 
Angus
Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.337
diff -u -p -r1.337 ChangeLog
--- lib/ChangeLog	5 Jan 2003 22:08:21 -0000	1.337
+++ lib/ChangeLog	6 Jan 2003 15:13:24 -0000
@@ -1,3 +1,8 @@
+2003-01-06  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* scripts/lyxpreview2bitmap.sh: don't use 'which' to find an executable.
+	Use 'type'.
+
 2003-01-05  John Levon  <[EMAIL PROTECTED]>
 
 	* lyx2lyx/lyxconvert_215.py: handle \lyxrcsid, \lyxvcid, \cursor
Index: lib/scripts/lyxpreview2bitmap.sh
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/scripts/lyxpreview2bitmap.sh,v
retrieving revision 1.8
diff -u -p -r1.8 lyxpreview2bitmap.sh
--- lib/scripts/lyxpreview2bitmap.sh	22 Nov 2002 12:00:05 -0000	1.8
+++ lib/scripts/lyxpreview2bitmap.sh	6 Jan 2003 15:13:24 -0000
@@ -54,7 +54,7 @@
 # Three helper functions.
 FIND_IT ()
 {
-	which ${EXECUTABLE} > /dev/null ||
+	type ${EXECUTABLE} > /dev/null ||
 	{
 		echo "Unable to find \"${EXECUTABLE}\". Please install."
 		exit 1
@@ -202,7 +202,7 @@ rm -f ${FILES} texput.log
 # The bitmap files can have large amounts of whitespace to the left and
 # right. This can be cropped if so desired.
 CROP=1
-which pnmcrop > /dev/null || CROP=0
+type pnmcrop > /dev/null || CROP=0
 
 # There's no point cropping the image if using PNG images. If you want to
 # crop, use PPM.

Reply via email to