unix – 如何从tcl脚本运行csh脚本?
发布时间:2020-12-15 21:08:46 所属栏目:安全 来源:网络整理
导读:我试图从tcl脚本运行csh脚本. 下面的tcl脚本调用csh脚本 #!/usr/bin/tclshset scripts_path /scratch/TCL_scripts/scripts_addersset synthesis /scratch/TCL_scripts/synthesis.cshset files [glob -directory $scripts_path *]split $filesset files [lsor
我试图从tcl脚本运行csh脚本.
下面的tcl脚本调用csh脚本 #!/usr/bin/tclsh set scripts_path /scratch/TCL_scripts/scripts_adders set synthesis /scratch/TCL_scripts/synthesis.csh set files [glob -directory $scripts_path *] split $files set files [lsort $files] set i 1 foreach script $files { puts "hello" # puts [pwd] exec /bin/csh -c $synthesis puts $i } 并且(开头)csh文件如下: #!/bin/csh -f echo abcdefgh 当我只从我的unix终端执行csh文件时,它工作正常. (我的Tcl脚本和csh脚本都是可执行的) 为了从我的Tcl脚本运行我的csh脚本,我该怎么办? 非常感谢你 解决方法
确实为你运行了csh脚本,但是默认情况下它的标准输出变成了Tcl exec命令的结果(如果它在标准错误上产生任何东西,那将成为exec的错误结果).要使输出和错误出现在终端上,您必须像这样修改exec:
exec /bin/csh -c $synthesis >@stdout 2>@stderr > @表示“将标准输出重定向到以下通道”(在本例中为stdout),并且2> @对标准错误执行相同操作. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |