2017-04-05 66 views
0

我正在执行guile shell中的一些命令。 我想将命令的结果写入文件。如何将scheme shell结果写入文件?

我想是这样的:

some command | nc localhost abc >> file.txt 

但对我来说没有工作。

+0

那是什么确切的命令?你可能想尝试'... localhost abc&> file.txt' –

回答

1

您需要display结果,以他们重定向:

guile -c '(display (+ 1 2 3 4)) (newline)' > output 
+0

谢谢迈克尔。它拯救了我的一天。 – vishnu

0

我尝试了以下内容和它的工作。

echo -e "(define out (open-output-file \"/opt/ncOutput.txt\"))\n(display \"hello world\" out)\n(close-output-port out)\n" | nc localhost abc 

IO operations with Guile