blob: a2e49d05a3212f76c2c60fac13649d8712ba87fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/bin/sh
gen_filter()
{
IFS=. read a b c d
[ "$a" -a "$b" -a "$c" -a "$d" ] || return
cprime=$((c+1))
echo s/$a\\.$b\\.$c\\.\\\([0-9]*\\\)/$a.$b.$cprime.\\\\1/g
}
get_default()
{
ip route | grep '^default via 192\.168\.[^.]*\.1' |
(read default via what ip; [ "$what" ] && echo $what)
}
get_default | gen_filter
|