Merge 4679935a86 into f13e04fdb0
commit
ff9aabc284
|
|
@ -7,10 +7,10 @@ function ips ()
|
||||||
group 'base'
|
group 'base'
|
||||||
if command -v ifconfig &>/dev/null
|
if command -v ifconfig &>/dev/null
|
||||||
then
|
then
|
||||||
ifconfig | awk '/inet /{ print $2 }'
|
ifconfig | grep -B 1 -E "inet "|sed 's/addr://g' | sed 's/://g'|awk '{if (NR%3==1) printf $1 " : "; else if (NR%3==2) {print $2}}'
|
||||||
elif command -v ip &>/dev/null
|
elif command -v ip &>/dev/null
|
||||||
then
|
then
|
||||||
ip addr | grep -oP 'inet \K[\d.]+'
|
ip addr | grep -B 2 'inet ' | sed 's/://g'|sed 's/\/[0-9]\+//g' | awk '{if(NR%4==1) printf $2 " : "; if(NR%4==3) print $2}'
|
||||||
else
|
else
|
||||||
echo "You don't have ifconfig or ip command installed!"
|
echo "You don't have ifconfig or ip command installed!"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ load ../../plugins/available/base.plugin
|
||||||
skip 'ifconfig probably requires sudo on TravisCI'
|
skip 'ifconfig probably requires sudo on TravisCI'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -r localhost='127.0.0.1'
|
declare -r localhost="lo : 127.0.0.1"
|
||||||
run ips
|
run ips
|
||||||
assert_success
|
assert_success
|
||||||
assert_line $localhost
|
assert_line "$localhost"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test 'plugins base: myip()' {
|
@test 'plugins base: myip()' {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue