> On 30 August 2017 at 17:51 Thomas Haller <[email protected]> wrote: > > On Wed, 2017-08-30 at 17:17 +0100, [email protected] > wrote: > > > I've not used nmcli in any of its more intricate ways, but are there > > some > > easily-parsed commands which will allow me to tell whether an > > Ethernet > > interface is up (a la 'nmcli conn up/down') AND the cable is > > connected > > ('link/carrier state')? > > I can grab some hints of the latter with /sys/class/net/eth0/carrier, > > but > > would prefer an approach that is harmonised through nmcli. Are there > > a > > couple of sub-commands that can be used rather than parsing the full > > 'nmcli > > dev show' output? e.g. to output a couple of specific fields. > > Hi, > > how about: > > LANG=C nmcli -t -m tabular -f WIRED-PROPERTIES.CARRIER device show "$DEV" > > Thomas
Thanks Thomas, that's the hints I was looking for :) I see I can do similar with GENERAL.STATE, for whether the connection has been taken up/down, and then logically And the two. But is there a way to be assured of what the textual result will be for this one: 100/30/20, "connected"/"disconnected"/"unavailable" ? It could be a headache if NM changes one day and alters the integer/text. _______________________________________________ networkmanager-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/networkmanager-list
