[net.unix] C shell script portability suggestion

root@ogcvax.UUCP (Bruce Jerrick) (02/11/84)

   I'm not sure what sort of portability problems mcvax!guido has
had that prompt him to recommend the Bourne shell for shell scripts
(ref. net.unix, 5684@mcvax.UUCP), but I'd be willing to bet that they
can be avoided by including:

    #! /bin/csh -f

as a header for *ALL* C-shell scripts, and necessarily as a result,
avoiding the use of aliases.  The "-f" will prevent the
reading of the user's .cshrc file.  If the .cshrc file is read, there
will be portability problems even within a site -- the behavior of the
shell script might be profoundly altered by a user's .cshrc file
(aliases would be the main cause; also things like "set noclobber").

        Bruce Jerrick
        Oregon Graduate Center
	(503) 645-1121 ex. 355
        CSNet:  bruce@Oregon-Grad
        UUCP:   ...teklabs!ogcvax!bruce
-- 
Bruce Jerrick
Oregon Graduate Center

john@genrad.UUCP (John Nelson) (02/14/84)

That would be a good idea (to use:    #! /bin/csh -f) except that this
construct is only supported by berkley kernals.  Not exactly a boon to
portability.  At least it lets you know up front which interpreter is
to be used!

crl@pur-phy.UUCP (Charles LaBrec) (02/14/84)

Sorry, but using:
	#! /bin/csh -f
as the first line of shell script is *NOT* portable.  This feature did not
exist in standard V7, although 2.8 BSD (for 11's) does have it.  Furthermore,
in 2.8, flags cannot be passed, so the "-f" above causes an error (the
kernel looks for "/bin/csh -f").

Charles LaBrec
UUCP:		pur-ee!Physics:crl, purdue!Physics:crl
INTERNET:	crl @ pur-phy.UUCP

dave@utcsrgv.UUCP (Dave Sherman) (02/15/84)

C shell scripts are by definition not portable to those UNIX systems
which do not run the C shell. It's that simple. Version 7 and
other BTL-stream UNIX releases can only use Bourne shell scripts.

Dave Sherman
-- 
 {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave