scripts

scripts to make my pc work
Index Commits Files Refs
ip.sh (443B)
   1 #!/bin/sh
   2 
   3 # Prints your local ip address. If you are connected both via wireless & \
   4 # ethernet then the ethernet ip is printed 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