我想弄清楚如何將內容/代碼添加到使用ssh命令的代碼已經存在的.js文件的末尾。通過ssh命令將內容添加到.js文件的末尾
即....
touch ./ap/includes/ckeditor/ckeditor.js
Maintain current code
echo "add custom end code only"> ./ap/includes/ckeditor/ckeditor.js
我想弄清楚如何將內容/代碼添加到使用ssh命令的代碼已經存在的.js文件的末尾。通過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
創建。
你希望'''追加而不是覆蓋。 – tripleee
非常感謝! – sven30