开发者

run csh scripts from bash, change shell temporary via command

开发者 https://www.devze.com 2023-01-24 07:42 出处:网络
I need to run csh scripts from a bash shell and therefore temporary change to tcsh via a command. It work开发者_如何转开发s perfect in interactive mode but i cant figure out in a one line command.

I need to run csh scripts from a bash shell and therefore temporary change to tcsh via a command. It work开发者_如何转开发s 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...


tcsh -c "echo foo; echo bar"

Result:

foo
bar

So this should work:

tcsh -c "source my.tcshr; useMyTcshCmd"


You should specify the interpreter directly in the script:

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

And then simply run the script:

./script


tcsh -c useMyTcshCmd
0

精彩评论

暂无评论...
验证码 换一张
取 消