#!/bin/bash
function print_log
{
echo "[$(date +'%Y-%m-%d:%H:%M:%S')]: $@" >&2
return 0
}
if [ $# -ne 2 ]
then
echo "Usage: sh $0 blockid_file snapshot_xml"
exit 1
fi
blockid_file=$1
snapshot_xml=$2
blockid=$(cat ${blockid_file} | paste -s -d' ')
sed -i "/MY_SNAPSHOT_BLOCK/s/MY_SNAPSHOT_BLOCK/${blockid}/" ${snapshot_xml}
if [ $? -ne 0 ]
then
print_log "replace failed"
exit 1
else
print_log "replace succee"
fi
脚本替换
最新推荐文章于 2023-02-22 18:09:20 发布