Skip to content

Commit

Permalink
refactor: ip.sh to be consistent with other scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
W-Floyd committed Nov 3, 2022
1 parent e22017e commit fb1e3ba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/ip.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

INTERFACE=${1}
__interface="${1}"
__state=$(cat "/sys/class/net/${__interface}/operstate")

STATE=$(cat /sys/class/net/$INTERFACE/operstate)
if [ "${STATE}" = 'down' ]; then
echo ${STATE}
if [ "${__state}" = 'down' ]; then
echo "${__state}"
else
echo $(ip -j address show $INTERFACE | jq -r '.[0].addr_info[0].local')
ip -j address show "${__interface}" | jq -r '.[0].addr_info[0].local'
fi

0 comments on commit fb1e3ba

Please sign in to comment.