我正在尝试弄清楚如何使用 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/