How to terminate a global cshrc-file

How to terminate a global cshrc-file

Post by Nis Peder Bon » Sat, 26 Sep 1992 18:39:05



Arch: Sun 4/330
SunOS: 4.1.1
Shell: csh

I have implemented a global cshrc-file by putting this line into
every users .cshrc-file:
                source /etc/csh.cshrc

So when a user starts a shell, /etc/csh.cshrc is executed BEFORE anything
else.

Now I want to put a command into /etc/csh.cshrc that terminates BOTH the
source of /etc/csh.cshrc AND the execution of the users .cshrc-file that
started the source.

I have tried many variants, but non of them seems to work.

"exit" only terminates the source of /etc/csh.cshrc but not the execution
of the .cshrc-file.

"kill -9 $$" kills BOTH the /etc/csh.cshrc, .cshrc AND the original
shell. But that is too much.

Is there a standard-solution?
I looked in the FAQ-list but couldn't find any references.
The manual doesn't say anything about this.

Please respond by E-mail, and I shall summarice to comp.unix.questions and
comp.unix.shell

                                Bonde
--

Systemadministrator, Datakontoret, Aarhus University
Phone     : +45 86 20 27 11 ext. 4993

Monday    : 10-12
Tuesday   : 12-14
Wednesday : 12-14
Thursday  : 12-14
Friday    : 10-11

 
 
 

1. How to terminate a global cshrc-file

In an article I asked, if it was posible to terminate further execution
of BOTH an .cshrc-file AND a global /etc/csh.cshrc-file implemented
by putting this line into every users .cshrc-file:
        source /etc/csh.cshrc

The problem was, that putting an exit into /etc/csh.cshrc only
terminated the source of this file and not the source of the users
own .cshrc-file.


possible, because csh isn't set up to permit changes in it's execution-
stack.

My real problem was that under some very special circumstances I didn't
want the user to perform the tset-command in his .cshrc-file. But as Tod
pointed out, it wasn't necessary to exit the source of .cshrc to achieve
this. Instead I could just put a wrapper around /usr/ucb/tset that only
calls the original tset-program when a special environment variable isn't
set.


.cshrc-files:
        source /etc/csh.cshrc
        if ($?leave_cshrc == 1) exit

Both solutions will ofcourse work, but in my situation the former is
more clean and reflects what I really wanted to achieve.


                                Bonde
--

Systemadministrator, Datakontoret, Aarhus University
Phone     : +45 86 20 27 11 ext. 4993

Monday    : 10-12
Tuesday   : 12-14
Wednesday : 12-14
Thursday  : 12-14
Friday    : 10-11

2. sorting output of "df" command

3. global cshrc files ?

4. Please help shed light on SYSLOGD problems

5. global cshrc/login file?

6. Netware on AIX

7. global cshrc files ? (SUMMARY)

8. USB Scanner Problem

9. global .login/.cshrc without modify the user copy

10. How to make a global cshrc on Solaris

11. Wups, forgot something -- Re: [Q] global .login/.cshrc

12. Terminating parent vs terminating children

13. Event Announcement: Internet Global Summit: Global Distruted Intelligence for Everyone