Skip to content
Advertisement

How can I make a hybrid bash/tcsh script on Linux?

I have one script which runs in Bash and and other which runs in tcsh.

I need to run them both from the same script. How can I create a script that can run both bash and tcsh commands?

Advertisement

Answer

Most shells have an argument which allow you to pass them a string to run as a command, for example, for bash you can run

bash -c "echo this is a bash script; echo lalalala"

to run that string as a script in bash, use this to run the needed shell embedded in the other. This will allow you to make a script in one shell which will invoke the other shell when the other program needs to be run.

If on the other hand they are both properly shebanged begin with #!tcsh or #!bash you can simply run both scripts from the same bash script using:

/path/to/script1 &
/path/to/script2 &
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement