Executing a script with a specific shell.

David Brooks dbrooks at osf.org
Fri Jan 5 04:56:12 AEST 1990


In article <1989Dec30.122215.2199 at virtech.uucp>, cpcahil at virtech.uucp
(Conor P. Cahill) writes:
> In article <1483 at lakesys.lakesys.com>, johnb at lakesys.lakesys.com (John
C. Burant) writes:
> > I'm using csh as my reular shell, and I need a file to be executed by sh,
> 
> Place a:
> 
> 	#!/bin/sh
> 
> as the first line of the shell file.  This always works under BSD unix and
> if your primary shell is the csh it will work under system V.

It doesn't work if you are dealing with a program that explicitly
executes your script using its own idea of the very best shell, and
you want the script to work under other circumstances also (I had
problems with xdm and xmh that way).

I saw something like:

	export foo || exec /bin/sh $0 $*

which will do what you want.  It does issue an error message and
doesn't take account of ksh; can anyone do better?
-- 
David Brooks				dbrooks at osf.org
Open Software Foundation		uunet!osf.org!dbrooks



More information about the Comp.unix.questions mailing list