Skip to content

Commit

Permalink
fix more shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-solana committed Jun 23, 2018
1 parent 13773b5 commit 031ee15
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions multinode-demo/myip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

function myip()
{
declare ipaddrs=(
$(curl -s ifconfig.co) # query interwebs
$(ifconfig | awk '/inet(6)? (addr:)?/ {print $2}') # machine interfaces
)
declare ipaddrs=( )
declare extips=( )

# query interwebs
mapfile -t ipaddrs < <(curl -s ifconfig.co)

# machine's interfaces
mapfile -t -O "${#ipaddrs[*]}" ipaddrs < \
<(ifconfig | awk '/inet(6)? (addr:)?/ {print $2}')

ipaddrs=( "${extips[@]}" "${ipaddrs[@]}" )

if (( ! ${#ipaddrs[*]} ))
then
Expand Down

0 comments on commit 031ee15

Please sign in to comment.