-i
sed -i '$a # modified part' test_file
-i : edit file
$ : the last line
a : append
在 test_file 的最後一行加上字串 # modified part
sed -i '/source setenv.sh/s/^/#/' $code_path/boot_images/build/ms/build.sh
目標file:$code_path/boot_images/build/ms/build.sh
在目標file裡,搜尋 “source setenv.sh “字串,
在最前方 ^
插入 #
整個意思就是,
找到 '/'
使用 '/' 代替。