linux - 通过 ssh 命令将内容添加到 .js 文件的末尾

标签 linux shell ssh

我正在尝试弄清楚如何使用 ssh 命令将内容/代码添加到已包含代码的 .js 文件的末尾。

即....

touch ./ap/includes/ckeditor/ckeditor.js
Maintain current code
echo "add custom end code only"> ./ap/includes/ckeditor/ckeditor.js

最佳答案

ssh命令用于连接到另一台服务器。

您可以将文本追加到文件末尾,以echo "something">>/your/file

所以根据你的代码:

touch ./ap/includes/ckeditor/ckeditor.js
Maintain current code
echo "add custom end code only" >> ./ap/includes/ckeditor/ckeditor.js
                                ^
                                |_ changed this

顺便说一下,touch 部分是不必要的。在文件内部回显时,文件的日期将被更新。如果文件不存在,将使用 echo 自动创建。

关于linux - 通过 ssh 命令将内容添加到 .js 文件的末尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16839222/

相关文章:

windows - 适用于 Windows 的命令行对话框工具

bash - 如何在 Bash 中执行 "tail this file until that process stops"?

linux - 杂乱和重复的输出

ssh - 我可以将服务器的 RSA 主机 key 作为 PuTTY 命令行选项传递吗?

java - 如何从 spring-config-server 应用程序使用 SSH 连接到 Bitbucket?

linux - Magento:有趣的网址

c - fork 后重新创建死线程

mysql - Centos mysql远程访问

linux - linux同步串口读取功能

exit() 能否终止进程?