如何从csh脚本中获取bash脚本(how to source a bash script from inside a csh script)

系统教程 行业动态 更新时间:2024-06-14 16:57:40
如何从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.sh

If 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...>

更多推荐

本文发布于:2023-04-13 12:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/da0bb87b85fc5f59be34e7764cdd5ac5.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   csh   bash   script   source

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!