以下代码:
set filex "./run.sh"
if {[file exist $filex]} {
puts "File exist!"
}
if {[catch {open |$filex r} pipe]} {
puts "pwd = [pwd]"
puts "ERROR: $pipe"
}返回以下消息:
文件存在!
pwd = F:/
错误:无法执行".\run.sh":没有这样的文件或目录
这个问题在linux中是不存在的(脚本通常是运行的),只出现在Windows中(在CygWin上也是)。该文件的权限为: 777。这两个操作系统都有通用的解决办法吗?
发布于 2020-02-24 10:50:06
我找到了解决这个问题的方法,我在“\”字符后面添加了bash:
if {[catch {open "|bash $filex" r} pipe]} {https://stackoverflow.com/questions/60325415
复制相似问题