Re: No ifconfig
On Tue 15 Aug 2017 at 19:13:54 (+0200), Pierre Frenkiel wrote:
> On Tue, 15 Aug 2017, Greg Wooledge wrote:
>
> >On Tue, Aug 15, 2017 at 06:24:42PM +0200, Pierre Frenkiel wrote:
> >>On Tue, 15 Aug 2017, Greg Wooledge wrote:
> >>
> >>>ip -o link | awk -F": " '{print $2}'
> >>
> >> and even shorter:
> >> ip -o link | cut -d : -f 2
> >
> >They are not equivalent. Yours leaves extra whitespace.
> >
> >wooledg:~$ ip -o link | cut -d : -f 2 | hd
> >00000000 20 6c 6f 0a 20 65 74 68 30 0a | lo. eth0.|
> >0000000a
> >wooledg:~$ ip -o link | awk -F": " '{print $2}' | hd
> >00000000 6c 6f 0a 65 74 68 30 0a |lo.eth0.|
> >00000008
> >
> >So, to use the output of yours, an additional step would be needed
> >(whitespace trimming).
> >
> If it's to list the interface names, I don't see why the leading space is
> annoying.
I assume then that you wrote your recipe just for our
entertainment. An error like that can waste a lot of time
when a non-trivial script produces unexpected results.
Cheers,
David.
Reply to: