repos/scripts

Simple scripts that I made for my personal computer to map keys, make bluetooth work, brightness keys, etc.
Commits Files Refs README LICENSE
ip.sh (15 lines)
   1 #!/bin/sh
   2 
   3 # Prints your local ip address. Ethernet connection has more priority over WiFi
   4 # by github.com/mjkloeckner
   5 
   6 estatus="$(cat /sys/class/net/e*/operstate)"
   7 
   8 if [ "$estatus" = "down" ];
   9     then ip=$(ip -o a | awk '/: w.*.inet .*/ { print $4 }' | sed 's/\// /' |\
  10         awk '{ print $1 }');
  11     else ip=$(ip -o a | awk '/: e.*.inet .*/ { print $4 }' | sed 's/\// /' |
  12         awk '{ print $1 }');
  13 fi;
  14 
  15 echo $ip