cshell within make

rwl at uvacs.UUCP rwl at uvacs.UUCP
Sat Jan 18 07:03:22 AEST 1986


> I have several script files written in csh syntax that perform some tests on
> files.  I would like to invoke them from within 'make.'  The problem is that
> make insists on using Bourne shell...this despite the fact that the first line
> in the script file is #/bin/csh, and it runs in csh fine when it is called
> interactively.
> 
:
> Am I missing something?  Is there a variable that can be set within the
> Makefile to always use /bin/csh?  Or an undocumented command line option?

Yeah, you are missing something.  The magic cookie that defines the
interpreter the system should choose when executing a shell script is "#!";
these characters should be the first two bytes of the file.  What you should
say at the top of your script is

	#! /bin/csh

not just

	#/bin/csh

which would not be interpreted by the kernel as anything meaningful and would
be interpreted as a comment in either sh(1) or csh(1).  It's not that make(1)
is insisting on using the Bourne shell to interpret the file, just that Unix
will use sh(1) as the interpreter when it doesn't know what else to use.

Unless you actually need your usual aliases within the script, I'd recommend
using the form

	#! /bin/csh -f

which will start up faster because it refrains from reading ~/.cshrc.
-- 

Ray Lubinsky		     University of Virginia, Dept. of Computer Science
			     uucp: decvax!mcnc!ncsu!uvacs!rwl



More information about the Comp.unix mailing list