Reputation: 7
So I have a few tcsh scripts associated with an expensive software that I have to run them on a bash shell system. Is that even possible? This software needs these scripts frequently and is based on tcsh. Is it possible to run 2 shells at the same time? Or just call tcsh shell at the beginning of the script? or is there any compiler to translate the shell scripts? What are my options? Thank you.
Upvotes: 0
Views: 1240
Reputation: 263237
Simply put a proper shebang at the top of the script.
Assuming your tcsh
is installed as /bin/tcsh
, each tcsh script should have this as its first line:
#!/bin/tcsh -f
(The -f
tells the shell not to load your startup scripts such as .login
or .tcshrc
. Any script shouldn't depend on your user environment, so you don't need to invoke your startup scripts -- and it will make your scripts load faster. Note that -f
has a different meaning for Bourne-derived shells; use -f
only for csh and tcsh scripts.)
If you can't portably assume where tcsh
is installed, an alternative is:
#!/usr/bin/env tcsh
But that doesn't let you use the -f
option, and it could have other disadvantages; see this answer for details.
Note that there really isn't such a thing as a "bash shell system". Both bash and tcsh are just programs that you can run. One or the other might happen to be the default interactive shell for newly created user accounts, but that doesn't affect being able to run either of them.
Upvotes: 1