diff --git a/panelctl.sh b/panelctl.sh index 2730690..6cd1e6d 100644 --- a/panelctl.sh +++ b/panelctl.sh @@ -254,7 +254,8 @@ cmd_render_route() { # Strip any existing block for this app from the aggregate file. if [[ -f "${APP_ROUTE_FILE}" ]]; then - grep -v "^# route:${name}:" "${APP_ROUTE_FILE}" >"${tmp}" || true + # Use sed to remove the block between # route:name:start and # route:name:end + sed "/^# route:${name}:start$/,/^# route:${name}:end$/d" "${APP_ROUTE_FILE}" >"${tmp}" || true else printf "" >"${tmp}" fi @@ -335,7 +336,7 @@ cmd_remove() { if [[ -f "${APP_ROUTE_FILE}" ]]; then local tmp tmp="$(mktemp)" - grep -v "^# route:${name}:" "${APP_ROUTE_FILE}" >"${tmp}" + sed "/^# route:${name}:start$/,/^# route:${name}:end$/d" "${APP_ROUTE_FILE}" >"${tmp}" || true mv "${tmp}" "${APP_ROUTE_FILE}" fi