fix: use cut and tail instead of awk

This commit is contained in:
ahwayakchih 2019-02-17 16:21:30 +01:00
parent 6c9bbc759d
commit f1b678290c
2 changed files with 3 additions and 3 deletions

View File

@ -54,6 +54,6 @@ mydevil_deploy() {
# Usage: ip=$(mydevil_get_ip domain.com)
# echo $ip
mydevil_get_ip() {
devil dns list "$1" | awk '{print $3"\t"$7}' | grep "^A$(printf '\t')" | awk '{print $2}' || return 1
devil dns list "$1" | cut -w -s -f 3,7 | grep "^A$(printf '\t')" | cut -w -s -f 2 || return 1
return 0
}

View File

@ -71,7 +71,7 @@ dns_mydevil_rm() {
return 1
fi
for id in $(devil dns list "$domain" | grep "$fulldomain" | awk '{print $1}'); do
for id in $(devil dns list "$domain" | grep "$fulldomain" | cut -w -s -f 1); do
_info "Removing record $id from domain $domain"
devil dns del "$domain" "$id" || _err "Could not remove DNS record."
done
@ -97,7 +97,7 @@ mydevil_get_domain() {
fulldomain=$1
domain=""
for domain in $(devil dns list | grep . | awk '{if(NR>1)print $1}'); do
for domain in $(devil dns list | cut -w -s -f 1 | tail -n+2); do
if _endswith "$fulldomain" "$domain"; then
printf -- "%s" "$domain"
return 0