Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从 bash shell 运行 csh 脚本,因此需要通过命令临时更改为 tcsh。它在交互模式下完美运行,但我无法在一行命令中弄清楚。因此,在交互模式下,我在 bash shell 中执行以下操作:
tcsh
源 my.tcshr
使用MyTcshCmd
等等
我怎样才能在 1 个命令中完成所有这些操作?对不起新手问题...
tcsh -c "echo foo; echo bar"
结果:
富 酒吧
所以这应该工作:
tcsh -c "source my.tcshr; useMyTcshCmd"
您应该直接在脚本中指定解释器:
#!/usr/bin/tcsh echo "doing stuff"
然后只需运行脚本:
./script
tcsh -c useMyTcshCmd