Brief
how can I (1) start a new csh, (2) get it to execute several commands that are NOT in any .cshrc (although I could arrange for them to be in a non-standard location to be the source) ed) and (3 ), then go online?
eg. is there any way to get csh or tcsh to sue alternative launch files other than those described in http://www.manpagez.com/man/1/tcsh/ which says
I already know about
Commissioning and shutdown The login shell starts by executing commands from the system files /etc/csh.cshrc and /etc/csh.login. Then it executes commands from files in the user's home directory: first ~ / .tcshrc (+) or, if ~ / .tcshrc is not found, ~ / .cshrc, then ~ / .history (or histfile value), then ~ / .login and finally ~ / .cshdirs (or the value of the dirsfile shell variable) (+). The shell can read /etc/csh.login earlier than after /etc/csh.cshrc, and ~ / .login before instead of ~ / .tcshrc or ~ / .cshrc and ~ / .history if this is so compiled; see version shell variable. (+)
Non-login shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc
DETAIL
I am a bash user. But I work for a hardware company where (1) many people are csh users, and (2) many of the CAD tools depend on material in the environment, such as a module system.
Many recipes, for example. internal wiki pages where people explain how to do things - start something like
start a new shell or xterm source /proj/Foo/setup.proj source ~some_engineer/env/setup-for-this-tool now run the tool
Environmental variables often conflict; sometimes I have to delete all my files ~ /.*, ssh again, etc.
I would like to automate many of them. Indeed, I have automated many of them. However, I had to automate them using wait (in fact, Perl CPAN Expect) in order to fake myself as an interactive user.
Along the way, I have my own clear-env script, which I often use to run a shell with almost no environment variables. Used this way:
clear-env -keep HOME -- csh and then either pipe commands in through expect or run interactively
This works for automation. But sometimes I really need to be interactive, but only after I have loaded a few lines with long script names.
I would like to be able to download the source files and then return to the interactive ones.
eg. I tried
clear-env -keep HOME -- csh -c 'source filename' -i ...
or, without my explicit env
csh -c 'source filename' -i ...
hoping that he executes the -c command and then becomes interactive. But it only executes the -c command.
I managed to pass commands to csh, waiting in a perl script of my own, which reads my tty, and then passes the command to csh via expect. However, I am losing the interactive features of csh.
Is there a better way? Some way to say: "From now on, I want you to reconnect your control terminal to this other terminal?"
Thanks.
By the way, this would be useful for other shells. However, my experience shows that csh users are most likely to write recipes that need to be done manually.
-
Perhaps I do not understand:
I know about
exec tcsh -c "source stuff ; exec bash"
and exec csh -c "source material, exec csh"
The situation is that I already ran the tool, script, a long way, using "interactive" commands through Expect.
Now, after I made this pseudo-interactive setup, I finally want to get back to being truly interactive. Basically, the control terminal change for the shell from pty that Expect used is in real pty.
I was able to do this by creating a forwarding process.
But I was hoping I could switch. Or do something like
... long ... sequence ... of expect commands exec csh -i < /dev/my-pty ...