Bash scripting help...

Mauricio Vergara Ereche mave at nic.cl
Mon Aug 7 21:24:54 UTC 2006


El Lunes, 7 de Agosto de 2006 17:26, Marko Vojinovic escribió:
[...]
> but the problem is that I just need to set the variable, say macaddr, to
> the above value, hopefully lowercase, without the [ and ]. Next obvious
> thing was:
>
> # arping -f -I eth0 $ipnumber | grep Unicast
> Unicast reply from 10.0.0.3 [00:0C:29:C8:DE:E2]  1.040ms

Try this:

macaddr=$(arping -f -I eth0 $ipnumber | grep Unicast | cut -d "[" -f1 | 
cut -d "]" -f2)

-- 
Mauricio Vergara Ereche                 User #188365 counter.li.org




More information about the fedora-list mailing list