testing if running shell script in {t}csh

testing if running shell script in {t}csh

Post by Luke Mewbu » Thu, 20 Aug 1992 11:15:23

What is a good reliable method of testing if you are not running as a
user shell (i.e, as a script).

Now, don't tell me about the existance of $prompt. This is no good if
the prompt is setup in /etc/csh.cshrc (or whatever), which I have no
control over whatsoever....

Thanx in advance


"...(and) We've heard how * prostitution, pregnancy,        Luke Mewburn

sweeping this nation. We thought you might like to share          minyos.
with the committee any particular *causes* you might see            xx.
for those latter problems..."                                      rmit.
"  I dunno, Maybe the proliferation of narrow, suffocating          oz.
zealotry masquerading as parenting in this country."                au
              Steve Dallas, 'Bloom County'.


1. running a program test in a shell script

We have two Unix machines, a Sun4 and an SGI 4D. Users log on to the SGI and
do most of their work there. There are however several bits of software that
are not available for the SGI but do have SUN4 versions. So we have set up
scripts for these packages that do an rlogin to the sun to invoke the
package concerned. (The users files are all share via NFS.) In general this
works well except for occasional problems caused by delays in updating
the directories of NFS mounted disks.

We recently started running Simscript in this manner. Simscript is a compiler
so it was necessary to provide scripts both for compiling and running the
programs. All was well until somebody named their executable 'test'.
This results in a script being generated and executed on the sun that includes
the line

test <parameters>

The symptoms were that the program exited without executing the first
statement of the program test. The reason (I assume) is that the test command
in the shell is being invoked and not the program test as found by following

I have had a look through the man pages for csh but can't find anything that
sheds light on what to do about this problem. I need a method of protecting
the command invoked in the script from being interpreted as shell commands.

Cheers Russell.
Russell Fulton, Computer Center, University of Auckland, New Zealand.

2. bad zmodem install

3. help in learning how to do Bourne shell scripts then converting them to csh scripts

4. Fonts and Window Managers in X

5. Running scripts without >csh script!

6. Help! Complex backgrounds on Netscape crash my system!

7. running a script form csh script

8. School Corporal Punishment

9. how to call csh scripts from inside other csh scripts

10. test test test test test test test

11. How to find other copies of same shell script running inside shell?

12. c-shell script won't run from korn-shell / SETUID

13. How to run shell script without login shell?