shell or c-shell?

Paul Davey paul at ixi.co.uk
Wed Mar 28 05:57:08 AEST 1990


In articles <20009 at cs.yale.edu> and <20050 at cs.yale.edu> 
chen-dahe at CS.YALE.EDU (Dahe Chen) writes:

>>I am having trouble with a shell script I wrote (forgive me ...)
>>
>>#! /bin/sh
>>#
>>MANPATH=/twolf7/dchen/man

>>It works if I explicitly invoke shell, i.e.,
>>
>>% sh [-x] man xxx
>>
>>but does not work when I do
>>
>>% man xxx
>>
>>which gives me
>>
>>No manual entry for .
>>
>
>I forgot to say that I am using ULTRIX-32 version 3.0 and that any
>other names for the shell script work in the c-shell. I am now puzzled
					      ?^^^^^?
>why the kernal can not determine correctly which shell to use if I use
>that very name. 

Do you mean that it still gives errors if you rename the script foo ??
Dou you mean it works if you rename it foo? 
What happens if you call it from sh?
Do you have any aliases set up (for man) ??

>Everything looks fine to me:

Me too, from what's here, though I can't see how you are getting the error 
message "No manual entry for ."  

If it is running under csh, you would get an error at the line 
"MANPATH=/twolf7/dchen/man"


Try debugging with the flags to sh set in the file , ie
#!/bin/sh -xv 
etc

If this does not produce diagnostics then you'll know that the #! line is 
not being used for some reason.

For diagnostic purposes you could try 
csh -XV man xxx 
( The capitals will show you if your .cshrc is doing anything )

Some other points,

1) Delete the space after #! to make line 1 #!/bin/sh
However this doesn't stop scripts on my system (bsd 4.3 based)
		It's probably just me being superstitious! -:)
(I always close things up to be safe, though this may be a red herring)

2) If you still distrust the kernal remove all the initial comments. 
Executable text files are passed to /bin/sh automatically, though it's
good style to put them in explicitly.

In fact since even old machines did not have the #! notation 
an initial # (with no !) means use C shell

This is a common way of getting csh when you wanted sh 
however you seem to have the reverse.


-- 
					                     
 Regards,			paul at ixi.co.uk          IXI Limited          
	 Paul Davey		...!uunet!ixi!paul      62-74 Burleigh Street
				+44 224 462 132 (fax)   Cambridge  U.K.      



More information about the Comp.unix.questions mailing list