Tra*_*er1 7 command-line bash files input
除了打开文本编辑器之外,还有什么方法可以将 linux 终端中的文本直接输入到文件中?(然后输入控制码如ctrl-c,结束输入)
我很确定有一种方法可以做到这一点......我通过 SSH 连接到带有 Docker 的服务器,并在容器内运行 bash,以便我可以测试一些东西,我只想能够粘贴一个小的我的终端窗口中的脚本,并将该输出输出到容器外壳内的文件中。
谢谢。
gle*_*man 11
一个有用的用途cat:在标准输入上提供输入
cat > filename
enter text
hit Ctrl-D to stop
Run Code Online (Sandbox Code Playgroud)
或使用heredoc
cat > filename << END
enter text
provide the terminating word to stop
END
Run Code Online (Sandbox Code Playgroud)