I am in a shared account, and would like to fire up a tcsh shell from a command line, and specify a custom .tcshrc file to source for this shell. tcsh is being run from a bash shell.

An equivalent to:

tcsh (go into new shell)
source /tmp/myRCFile.tcsh

Is there a way to specify the source command before entering the new shell with an alias? Or is there a better way?

Thanks much as I'm very tired of typing this.


If you can live with spawning two shells (i.e. $SHLVL increasing by two):

tcsh -c 'source /tmp/myRCFile.tcsh; tcsh'
| improve this answer | |
  • thank you for your answer, but yes would like to just spawn one shell if possible – koolunix Feb 12 '16 at 23:14
  • 1
    Understood. However, I doubt that this is possible in tcsh without modifying the startup file. You could alias the source command to make it easier. You could hook into cd to get direnv-like directory-specific settings. You could also use expect as proposed by [this SO answer] (stackoverflow.com/a/32454088/201318). – kba stands with Monica Feb 13 '16 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.