Skip to content

Commit

Permalink
Remove -e option in awk (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfut committed Apr 27, 2019
1 parent ef5bdf1 commit 40495b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions nmcli-cli-ipv4-copy
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ ipv4_copy() {
local DEST_IF_NAME=${2:-${SRC_IF_NAME}}

# IP + Method
SRC_IP_SUBNET=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.addresses:" | awk -e '{ print $2 }' | tr -d '-')
SRC_METHOD=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.method:" | awk -e '{ print $2 }' | tr -d '-')
SRC_IP_SUBNET=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.addresses:" | awk '{ print $2 }' | tr -d '-')
SRC_METHOD=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.method:" | awk '{ print $2 }' | tr -d '-')
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv4.addresses \"${SRC_IP_SUBNET}\" ipv4.method "${SRC_METHOD}"

# Gateway
SRC_GATEWAY=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.gateway:" | awk -e '{ print $2 }' | tr -d '-')
SRC_GATEWAY=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.gateway:" | awk '{ print $2 }' | tr -d '-')
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv4.gateway \"${SRC_GATEWAY}\"

# DNS
SRC_DNS=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.dns:" | awk -e '{ print $2 }' | tr -d '-')
SRC_DNS=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.dns:" | awk '{ print $2 }' | tr -d '-')
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv4.dns \"${SRC_DNS}\"

cat << _EOF_
Expand Down
8 changes: 4 additions & 4 deletions nmcli-cli-ipv6-copy
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ ipv6_copy() {
local DEST_IF_NAME=${2:-${SRC_IF_NAME}}

# IP
SRC_IP_SUBNET=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.addresses:" | awk -e '{ print $2 }' | tr -d '-')
SRC_METHOD=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.method:" | awk -e '{ print $2 }' | tr -d '-')
SRC_IP_SUBNET=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.addresses:" | awk '{ print $2 }' | tr -d '-')
SRC_METHOD=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.method:" | awk '{ print $2 }' | tr -d '-')
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv6.addresses \"${SRC_IP_SUBNET}\" ipv6.method "${SRC_METHOD}"

# Gateway
SRC_GATEWAY=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.gateway:" | awk -e '{ print $2 }' | tr -d '-')
SRC_GATEWAY=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.gateway:" | awk '{ print $2 }' | tr -d '-')
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv6.gateway \"${SRC_GATEWAY}\"

# DNS
SRC_DNS=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.dns:" | awk -e '{ print $2 }' | tr -d '-')
SRC_DNS=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.dns:" | awk '{ print $2 }' | tr -d '-')
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv6.dns \"${SRC_DNS}\"

cat << _EOF_
Expand Down

0 comments on commit 40495b9

Please sign in to comment.