[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] eth0 up or down?
From: |
Pierre Gaston |
Subject: |
Re: [Help-bash] eth0 up or down? |
Date: |
Sun, 23 Apr 2017 16:35:19 +0300 |
On Sun, Apr 23, 2017 at 8:08 AM, Mike McClain <address@hidden>
wrote:
> Howdy,
> How can I tell from bash whether eth0 is up or down that would be
> faster or less expensive than $(ifconfig eth0;)? Is there some where
> in /proc or elsewhere in memory a bash program can reach?
> Thanks for your thoughts,
> Mike
> --
> A wise man will make more opportunities than he finds.
> - Francis Bacon
>
>
You don't mention the OS you are targeting, you might be able to do
something like: $(</sys/class/net/eth0/operstate).
Though if you are not running this in a quick loop the price you pay for a
fork is probably not a problem