2013-05-30 27 views
0

我想弄清楚如何將內容/代碼添加到使用ssh命令的代碼已經存在的.js文件的末尾。通過ssh命令將內容添加到.js文件的末尾

即....

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

你希望'''追加而不是覆蓋。 – tripleee

+0

非常感謝! – sven30

回答

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創建。

+1

不錯,完美的工作!謝謝! – sven30

+0

有人可以標記我的問題。有人將其標記下來,我不知道爲什麼。 – sven30

相關問題