summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2013-02-01 20:06:55 +0200
committerVille Skyttä <ville.skytta@iki.fi>2013-02-01 20:06:55 +0200
commit19ce23282ca6c00b482ac8044b64d91dbb3b62e6 (patch)
tree7bf7df7e130418e6a6b84e87613b68c19805f8c1
parent87dede96c0fe8961081310284bfe58972dd801c4 (diff)
downloadbash-completion-19ce23282ca6c00b482ac8044b64d91dbb3b62e6.tar.gz
wol: Try "ip addr" before ifconfig for finding out broadcast addresses.
-rw-r--r--completions/wol8
1 files changed, 5 insertions, 3 deletions
diff --git a/completions/wol b/completions/wol
index 02030aba..ce1b7c50 100644
--- a/completions/wol
+++ b/completions/wol
@@ -11,9 +11,11 @@ _wol()
;;
-h|--host|-i|--ipaddr)
# Broadcast addresses
- COMPREPLY=( $( PATH=$PATH:/sbin ifconfig -a 2>/dev/null | \
- sed -ne 's/.*[[:space:]]\{1,\}Bcast:\([^[:space:]]*\).*/\1/p' \
- -e 's/.*[[:space:]]\{1,\}broadcast[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' ) )
+ local PATH=$PATH:/sbin
+ COMPREPLY=( $( { ip addr show || ifconfig -a; } 2>/dev/null | \
+ sed -ne 's/.*[[:space:]]Bcast:\([^[:space:]]*\).*/\1/p' -ne \
+ 's/.*inet.*[[:space:]]brd[[:space:]]\([^[:space:]]*\).*/\1/p' -ne \
+ 's/.*[[:space:]]broadcast[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' ) )
_known_hosts_real "$cur"
return 0
;;