newwpuser=$cpuser"_"$wpuser
newwpdb=$cpuser"_"$wpdb
wpdb=($(find . -name "wp-config.php" -print0 | xargs -0 -r grep -e "DB_NAME" | cut -d \' -f 4))
wpuser=($(find . -name "wp-config.php" -print0 | xargs -0 -r grep -e "DB_USER" | cut -d \' -f 4))
wpconfigchanges=($(find . -name wp-config.php -type f))
for i in "${wpconfigchanges[@]}"; do -exec sed -i -e "/DB_USER/s/'$wpuser'/'$newwpuser'/" | -exec sed -i -e "/DB_NAME/s/'$wpdb'/'$newwpuser'/"; done
我试图运行以上为了找到所有的wordpress配置和附加的数据库用户和dbname与cpuser_
但是-我得到了下面的错误;
./test.sh: line 85: -exec: command not found
./test.sh: line 85: -exec: command not found
我是否输入了错误的执行命令?
执行时输入CPUser
1条答案
按热度按时间dgjrabp21#
是的,您输入了错误的exec命令。
-exec
选项应该单独写在一行中。另外,您需要在每个-exec
命令的末尾添加;
,以指示命令的结束。以下是您的脚本的更正版本: