1

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?

3
  • 1
    csh is very different from bash. You can consider portability with sh-derived shells instead, but not with tcsh. It's -very- difficult to keep compatibility with *csh an *sh. Commented Jul 18, 2014 at 12:57
  • 2
    One of my programs only runs in Bash and the other only runs in tcsh "Please explain..." Commented Jul 18, 2014 at 12:57
  • 1
    bash prog1 & csh prog2 &? Commented Jul 18, 2014 at 13:01

1 Answer 1

1

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 &
Sign up to request clarification or add additional context in comments.

20 Comments

I'm pretty new to linux so can you please help me out? In this picture: fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpa1/v/t34.0-12/… In the top of the page, you see the bash shell. If I run whatever I have typed in (without the &), everything would run perfectly. Note the directory on the left side. Now, I also want to run the "run.sh" program in that bottom directory (the mesh_bandwidth... one). Could you please tell me what I should run? Thanks
Ah, it sounds like what you are looking for is to run the script by absolute path, if you write your command as: parsecmgmt -a run -p blackscholes & ; /home/linaro/--removedLongPath--/run.sh it should do what you want, note I have not written out the full path (takes me too long to copy the path out of the photo) but you will need to, basically you can run any script by typing the full path to run it from anywhere instead of having to be in the same folder. Is that what you need? If that is what you want I can edit it into the answer.
I got this error: fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/… Any idea of what I did wrong?
@user3853033 Try without the ; or failing that put a newline after the &. To expand a little ; means effectively "end of command" and & means "run preceding command in background (without blocking)", however & may imply a ; making the ; wrong, sorry.
@user3853033 By the way, in future you may have more luck on the unix and Linux stack exchange, it is there specifically for this kind of issue: unix.stackexchange.com
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.