我正在尝试弄清楚如何使用ssh命令将内容/代码添加到已经包含代码的.js文件的末尾。
...即
touch ./ap/includes/ckeditor/ckeditor.js
Maintain current code
echo "add custom end code only"> ./ap/includes/ckeditor/ckeditor.js
答案 0 :(得分:2)
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
自动创建。