是的,open 命令在 Linux 中可以用于重定向输出
例如,假设你有一个名为 script.sh 的脚本,你想将其输出重定向到名为 output.txt 的文件中。你可以使用以下命令:
./script.sh > output.txt
这将运行 script.sh,并将其输出保存到 output.txt 文件中。如果 output.txt 文件尚不存在,它将被创建;如果已经存在,它的内容将被覆盖。如果你想将输出追加到现有文件中,可以使用双重定向操作符 >>:
./script.sh >> output.txt
这将把 script.sh 的输出追加到 output.txt 文件的末尾。