replace string
#!/bin/bash
# replace target str
#read -p "Please input your target string: " target_str # 提示使用者輸入
#read -p "Please input your new string: " new_str # 提示使用者輸入
echo "Do you want to replace this PHP from $1 to $2" # 結果由螢幕輸出
echo "grep -Rnrl --include=\*.php \"$1\" /var/www/project/ | xargs -pi sed -i \"s/$1/$2/g\" {}"
read -p "==> Do you need atuorun this replace script? (Y/N) " ans
case $ans in
[Yy] )
grep -Rnrl --include=\*.php "$1" /var/www/project/ | xargs -pi sed -i "s/$1/$2/g" {}
;;
[Nn] )
echo "Skipping autorun..."
;;
* )
;;
esac