Keith MARSHALL writes: > > Really? I didn't know that, sorry. I used `type' to check that all of the > necessary prerequisite programs are installed, because I understood that it > *was* standard in Bourne shell; I've never come across one that didn't have > it, but my experience has been exclusively with System V, (since SVR2), and > more recently with GNU/Linux.
To my knowledge, it has *never* been in the Bourne shell, it is the Korn shell's (ksh) answer to the C shell's "which" command. On SysV, it is fairly common to have sh be a link to ksh rather than being the real Bourne shell (that's how David Korn "proved" that ksh was completely upward compatible with sh -- he replaced sh with ksh on many of AT&T's systems and no one noticed), which is probably the source of your confusion. > I followed the portability guidelines in the > Autoconf documentation, which does not list `type' as a non-portable Bourne > shell builtin, (in the `info' for 2.59) :-( Probably for the same reason it doesn't list "foobar" as a non-portable Bourne shell builtin. :-) The current more-or-less definitive specification of the shell command language is that specified by the Single UNIX Specification/POSIX: <http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html> The built-ins are on a separate page: <http://www.opengroup.org/onlinepubs/009695399/idx/sbi.html> > 3) For each test currently implemented using `type', reproduce the program > file location strategy used by Autoconf; this is likely to result in the > most portable solution, but is rather long winded. > > 4) Implement `type' as a shell function, based on the Autoconf strategy, > within `pdfroff.sh'; this would appear to be the most attractive option, > *but* the Autoconf documentation says not to use shell functions. I agree with your analysis. For what it's worth, CVS (which is also GNU software and widely portable) has the same problem in its test suite (although not in the core product) and uses a shell function to solve it. In fact, the test suite makes extensive use of shell functions. So I suggest going with 4: it's inifinitely better than using "type" and it seems to be "portable enough". -Larry Jones I'm getting disillusioned with these New Years. -- Calvin _______________________________________________ Groff mailing list Groff@gnu.org http://lists.gnu.org/mailman/listinfo/groff