user501743
user501743

Reputation: 199

run csh scripts from bash, change shell temporary via command

I need to run csh scripts from a bash shell and therefore temporary change to tcsh via a command. It works perfect in interactive mode but i cant figure out in a one line command. So in interactive mode i do in the bash shell:

tcsh

source my.tcshr

useMyTcshCmd

etc.

How can i do all of this in 1 command? Sorry for the newbie question...

Upvotes: 7

Views: 46813

Answers (3)

Tometzky
Tometzky

Reputation: 23880

tcsh -c "echo foo; echo bar"

Result:

foo
bar

So this should work:

tcsh -c "source my.tcshr; useMyTcshCmd"

Upvotes: 18

Raghuram
Raghuram

Reputation: 52645

tcsh -c useMyTcshCmd

Upvotes: 0

Šimon Tóth
Šimon Tóth

Reputation: 36433

You should specify the interpreter directly in the script:

#!/usr/bin/tcsh
echo "doing stuff"

And then simply run the script:

./script

Upvotes: 3

Related Questions