我试图在两个字符串上使用 tcl exec diff 在 tclsh 中产生相同的 diff 命令输出。
你能告诉我如何使用 tclsh exec diff 解决这个例子吗
使用 Bash
$ diff <(echo "Testword") <(echo "Testword2")
1c1
< Testword
---
> Testword2
TCL 失败
set str1 "Testword"
set str2 "Testword2"
第一次尝试
% exec diff <(echo "$string1") <(echo "$string2")
extra characters after close-quote
第二次尝试
% exec diff <(echo \"$string1\") <(echo \"$string2\")
couldn't read file "(echo": no such file or directory
第三次尝试
% exec diff \<(echo \"$string1\") \<(echo \"$string2\")
couldn't read file "(echo": no such file or directory
第四次尝试
% set command [concat /usr/bin/diff <(echo \\"$string1\\") <(echo \\"$string2\\")]
/usr/bin/diff <(echo \"Malli\") <(echo \"Malli1\")
% exec $command
couldn't execute "/usr/bin/diff <(echo \"Malli\") <(echo \"Malli1\")": no such file or directory.