zenu

Des menus dans votre terminal - retour accueil

git clone git://bebou.netlib.re/zenu
Log | Files | Refs | README |

network (577B)


      1 _chose interface
      2 _up
      3 _down
      4 _get ip addr
      5 get up (u_+g)
      6 ## pre
      7 local save=$zenu_store/network_interface
      8 local state=$zenu_store/network_state
      9 local nif=
     10 touch $save
     11 read nif < $save
     12 echo
     13 ip -br a | sed -r "
     14 	s/ /! /   # separator for pick
     15 	s/^/   /  # margin
     16 "| tee $state |
     17 sed "/${nif:-é}!/s/.*/\x1b[7m&\x1b[m/;s/!/ /"
     18 ## react
     19 ;; (c)
     20 	zenu.up $(( $(< $state wc -l) + 1 ))
     21 	< $state IFS='!' pick -Xd > $save
     22 	read nif < $save
     23 ;; (u) doas ip li set $nif up
     24 ;; (d) doas ip li set $nif down
     25 ;; (g) doas /sbin/dhclient $nif
     26 ;; (+) doas ip li set $nif up
     27 	doas /sbin/dhclient $nif