首页 > 代码库 > shell脚本编写汇集

shell脚本编写汇集

##1
sed -i ‘s/disabled=true/disabled=false/‘ /etc/fdfs/storage.conf
##2
sed -i ‘s/base_path=\/home\/yuqing\/fastdfs/base_path=\/fdfs\/storage/‘ /etc/fdfs/storage.conf
##3
echo "Enter Tracker_IP : "
read Tracker_IP
echo "$Tracker_IP"
sed -i "/tracker_server/ s/192.168.209.121/$Tracker_IP/" /etc/fdfs/storage.conf
##4 如果上面的tracker_server在源文件中的值不是固定的,应改成下面的写法:
echo "Enter Tracker_IP : "
read Tracker_IP
echo "$Tracker_IP"
sed -i "/tracker_server/ s/\(.*=\).*/\1$Tracker_IP/" /etc/fdfs/storage.conf


## 这样写法是不对的 :
sed -i "s/tracker_server=192.168.209.121/tracker_server=$Tracker_IP/" /etc/fdfs/storage.conf