-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting sed error using dns_linode_v4 on macOS/Ubuntu: RE error: invalid repetition count(s) #3645
Comments
I have tracked this down to these two lines in resource="$(echo "$response" | _egrep_o "\{.*\"name\": *\"$_sub_domain\".*}")" And line 143: hostedzone="$(echo "$response" | _egrep_o "\{.*\"domain\": *\"$h\".*}")"
_egrep_o() {
if ! egrep -o "$1" 2>/dev/null; then
sed -n 's/.*\('"$1"'\).*/\1/p'
fi
} And #!/bin/bash
set -o xtrace
_egrep_o() {
if ! egrep -o "$1" 2>/dev/null; then
sed -n 's/.*\('"$1"'\).*/\1/p'
fi
}
response='foo'
_sub_domain=yurt.dribin.net
echo "foo" | _egrep_o "\{.*\"name\": *\"$_sub_domain\".*}"
|
I can fix it by removing the backslash, but I don't know how that affects other platforms: diff --git a/dnsapi/dns_linode_v4.sh b/dnsapi/dns_linode_v4.sh
index 9504afb..2933c87 100755
--- a/dnsapi/dns_linode_v4.sh
+++ b/dnsapi/dns_linode_v4.sh
@@ -74,7 +74,7 @@ dns_linode_v4_rm() {
if _rest GET "/$_domain_id/records" && [ -n "$response" ]; then
response="$(echo "$response" | tr -d "\n" | tr '{' "|" | sed 's/|/&{/g' | tr "|" "\n")"
- resource="$(echo "$response" | _egrep_o "\{.*\"name\": *\"$_sub_domain\".*}")"
+ resource="$(echo "$response" | _egrep_o "{.*\"name\": *\"$_sub_domain\".*}")"
if [ "$resource" ]; then
_resource_id=$(printf "%s\n" "$resource" | _egrep_o "\"id\": *[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ )
if [ "$_resource_id" ]; then
@@ -140,7 +140,7 @@ _get_root() {
return 1
fi
- hostedzone="$(echo "$response" | _egrep_o "\{.*\"domain\": *\"$h\".*}")"
+ hostedzone="$(echo "$response" | _egrep_o "{.*\"domain\": *\"$h\".*}")"
if [ "$hostedzone" ]; then
_domain_id=$(printf "%s\n" "$hostedzone" | _egrep_o "\"id\": *[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ )
if [ "$_domain_id" ]; then |
Looks like the backslashes were explicitly added with commit 38a8721. |
you don't have |
I do:
|
I ran response="$(echo "$response" | tr -d "\n" | tr '{' "|" | sed 's/|/&{/g' | tr "|" "\n")"
while true; do
h=$(printf "%s" "$domain" | cut -d . -f $i-100)
_debug h "$h"
if [ -z "$h" ]; then
#not valid
return 1
fi
hostedzone="$(echo "$response" | _egrep_o "\{.*\"domain\": *\"$h\".*}")"
I don't know exactly what this line is trying to do: hostedzone="$(echo "$response" | _egrep_o "\{.*\"domain\": *\"$h\".*}")" But there is no |
FWIW, this also fails on Ubuntu 20.04, but with a different error message:
|
_egrep_o() {
if ! egrep -o "$1" 2>/dev/null; then
sed -n 's/.*\('"$1"'\).*/\1/p'
fi
} I don't think this |
Reviving this old thread, as I'm struggling with same sed error on an Ubuntu 20.04 server. just to follow up on this comment:
I think the purpose is to extract a matching substring, like so:
or return empty string if no match found:
|
I made a fix, please try again:
|
That worked and resolved my issue. Thank you! |
Steps to reproduce
I'm on macOS Catalina 10.15.7. Following the instructions from:
https://github.com/acmesh-official/acme.sh/wiki/dnsapi#14-use-linode-domain-api
I see two
sed
errors:Debug log
The text was updated successfully, but these errors were encountered: