如何从csh脚本中获取bash脚本(how to source a bash script from inside a csh script)
#!/bin/csh -x
exec bash
source ~arovit/RTM_test/unit_RTM/fail.10/failure.001.sh
exec csh
<script continues...>
有没有其他方法可以这样做?
#!/bin/csh -x exec bash source ~arovit/RTM_test/unit_RTM/fail.10/failure.001.sh exec csh <script continues...>is there any other way to do so ?
最满意答案
如果bash脚本的全部目的是导出相关的env变量,我建议你将脚本作为bash运行,使用csh调用以下脚本。 例如:
#!/bin/bash source ~arovit/RTM_test/unit_RTM/fail.10/failure.001.sh csh -x your_csh_script.sh如果bash脚本没有导出变量,并且只是执行一些任务,则反过来执行:
#!/bin/csh -x bash ~arovit/RTM_test/unit_RTM/fail.10/failure.001.sh <script continues...>If the whole purpose of the bash script is to export the relevant env variables, I'd suggest you run the script as bash, the call the following script using csh. E.g.:
#!/bin/bash source ~arovit/RTM_test/unit_RTM/fail.10/failure.001.sh csh -x your_csh_script.shIf the bash script isn't exporting vars, and is simply performing some tasks, then do it the other way round:
#!/bin/csh -x bash ~arovit/RTM_test/unit_RTM/fail.10/failure.001.sh <script continues...>更多推荐
发布评论