使用sed替換文本

實例

#!/bin/bash
timestamp=`date "+%Y%m%d%H%M%S"`
baseDir=$(cd "$(dirname "$0")";pwd)
sed "s/version/$timestamp/g" ${baseDir}/demo.yaml > ${baseDir}/tmp.yml

在sed中使用變量,用雙引號
shell腳本中執行函數,用``引用起來shell

相關文章
相關標籤/搜索