Browse Source

use head -n

pull/311/head
neil 8 years ago
parent
commit
ef858ef062
  1. 6
      acme.sh
  2. 4
      dnsapi/dns_cf.sh

6
acme.sh

@ -1049,7 +1049,7 @@ _send_signed_request() {
_debug3 _headers "$_headers" _debug3 _headers "$_headers"
nonce="$( echo "$_headers" | grep "Replay-Nonce:" | head -1 | tr -d "\r\n " | cut -d ':' -f 2)"
nonce="$( echo "$_headers" | grep "Replay-Nonce:" | head -n 1 | tr -d "\r\n " | cut -d ':' -f 2)"
_debug3 nonce "$nonce" _debug3 nonce "$nonce"
@ -2412,7 +2412,7 @@ issue() {
fi fi
_rcert="$response" _rcert="$response"
Le_LinkCert="$(grep -i '^Location.*$' $HTTP_HEADER | head -1 | tr -d "\r\n" | cut -d " " -f 2)"
Le_LinkCert="$(grep -i '^Location.*$' $HTTP_HEADER | head -n 1 | tr -d "\r\n" | cut -d " " -f 2)"
_savedomainconf "Le_LinkCert" "$Le_LinkCert" _savedomainconf "Le_LinkCert" "$Le_LinkCert"
if [ "$Le_LinkCert" ] ; then if [ "$Le_LinkCert" ] ; then
@ -2451,7 +2451,7 @@ issue() {
_cleardomainconf "Le_Vlist" _cleardomainconf "Le_Vlist"
Le_LinkIssuer=$(grep -i '^Link' $HTTP_HEADER | head -1 | cut -d " " -f 2| cut -d ';' -f 1 | tr -d '<>' )
Le_LinkIssuer=$(grep -i '^Link' $HTTP_HEADER | head -n 1 | cut -d " " -f 2| cut -d ';' -f 1 | tr -d '<>' )
if ! _contains "$Le_LinkIssuer" ":" ; then if ! _contains "$Le_LinkIssuer" ":" ; then
Le_LinkIssuer="$API$Le_LinkIssuer" Le_LinkIssuer="$API$Le_LinkIssuer"
fi fi

4
dnsapi/dns_cf.sh

@ -61,7 +61,7 @@ dns_cf_add(){
_err "Add txt record error." _err "Add txt record error."
else else
_info "Updating record" _info "Updating record"
record_id=$(printf "%s\n" "$response" | _egrep_o \"id\":\"[^\"]*\" | cut -d : -f 2 | tr -d \"| head -1)
record_id=$(printf "%s\n" "$response" | _egrep_o \"id\":\"[^\"]*\" | cut -d : -f 2 | tr -d \"| head -n 1)
_debug "record_id" $record_id _debug "record_id" $record_id
_cf_rest PUT "zones/$_domain_id/dns_records/$record_id" "{\"id\":\"$record_id\",\"type\":\"TXT\",\"name\":\"$fulldomain\",\"content\":\"$txtvalue\",\"zone_id\":\"$_domain_id\",\"zone_name\":\"$_domain\"}" _cf_rest PUT "zones/$_domain_id/dns_records/$record_id" "{\"id\":\"$record_id\",\"type\":\"TXT\",\"name\":\"$fulldomain\",\"content\":\"$txtvalue\",\"zone_id\":\"$_domain_id\",\"zone_name\":\"$_domain\"}"
@ -103,7 +103,7 @@ _get_root() {
fi fi
if printf $response | grep \"name\":\"$h\" >/dev/null ; then if printf $response | grep \"name\":\"$h\" >/dev/null ; then
_domain_id=$(printf "%s\n" "$response" | _egrep_o \"id\":\"[^\"]*\" | head -1 | cut -d : -f 2 | tr -d \")
_domain_id=$(printf "%s\n" "$response" | _egrep_o \"id\":\"[^\"]*\" | head -n 1 | cut -d : -f 2 | tr -d \")
if [ "$_domain_id" ] ; then if [ "$_domain_id" ] ; then
_sub_domain=$(printf $domain | cut -d . -f 1-$p) _sub_domain=$(printf $domain | cut -d . -f 1-$p)
_domain=$h _domain=$h

Loading…
Cancel
Save