location="
location /projects/test/v2.0.1-4 {
proxy_pass http://0.0.0.0:2222;
}
"
sed -i "/modsecurity/i $location" MYFILE
sed: -e expression #1, char 22: extra characters after command
каждая вставляемая строка должна оканчиваться слэшом
#!/bin/bash
location='
location /projects/test/v2.0.1-4 {
proxy_pass http://0.0.0.0:2222;
}'
sed -i "
/modsecurity/i ${location//$'\n'/\\$'\n'}
" MYFILE