When the Rancher container is upgraded, the execution of the shell script reports an error: sed: -e expression #1, char 37: unknown option to `sanalysis and solution
1. When the RAncher container is upgraded, execute the shell script error: sed: -e expression #1, char 37: unknown option to `s, as shown in Figure 1
2. The value of the environment variable CMCP_API_CFG_REdis_password is q5dhp@xcbuujy^L, which leads to the failure of the upgrade, and the value is changed to q5dhp@xcbuujyl, remove the ^ symbol, upgrade again, the upgrade failed
3. Modify the value to Q5Dhpxcbuujy^L, remove the @ symbol, upgrade again, and the upgrade is successful
sed -i "s@cmcp_api_cfg_redis_hostname@$cmcp_api_cfg_redis_hostname@g" /sobey/www/cmcp-api/.env;
4. The value of the environment variable CMCP_API_CFG_REdis_password is q5dhp@xcbuujy^L, which leads to the failure of the upgrade, and finally decided not to modify the original value and modify the shell file, replace @ with #, the upgrade is successful
sed -i "s@cmcp_api_cfg_redis_hostname@$cmcp_api_cfg_redis_hostname@g" /sobey/www/cmcp-api/.env;
sed -i "S#CMCP_API_CFG_REDIS_HOSTNAME#$CMCP_API_CFG_REDIS_HOSTNAME#G" /sobey/www/cmcp-api/.env;
5. To sum up, in the shell, the search and replacement of the data, the default is: seds/strings to be replaced/new strings/gbut where / can be replaced with other strings to avoid conflicts
