Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!snorkelwacker!paperboy!osf.org!dbrooks From: dbrooks@osf.org (David Brooks) Newsgroups: comp.unix.questions Subject: Re: Executing a script with a specific shell. Message-ID: <2418@paperboy.OSF.ORG> Date: 4 Jan 90 17:56:12 GMT References: <1989Dec30.122215.2199@virtech.uucp> <1483@lakesys.lakesys.com> Sender: news@OSF.ORG Reply-To: dbrooks@osf.org (David Brooks) Distribution: usa Organization: Open Software Foundation Lines: 27 In article <1989Dec30.122215.2199@virtech.uucp>, cpcahil@virtech.uucp (Conor P. Cahill) writes: > In article <1483@lakesys.lakesys.com>, johnb@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@osf.org Open Software Foundation uunet!osf.org!dbrooks