dotfiles/.config/shell/utils.d/web.sh
Alexander Hess a8f8caccc0
Re-organize the shells' initialization logic
- unify ~/.config/shell/aliases.sh and ~/.config/shell/utils.sh
  into a common ~/.config/shell/init.sh
- split the contents of ~/.config/shell/aliases.sh
  into the folder ~/.config/shell/aliases.d
- split the contents of ~/.config/shell/utils.sh
  into the folder ~/.config/shell/utils.d
2022-08-14 17:38:43 +02:00

26 lines
458 B
Bash

# This file defines various utilities regarding "the web"
_command_exists() {
command -v "$1" 1>/dev/null 2>&1
}
# List all internal IPs
internal-ips() {
if _command_exists ifconfig; then
ifconfig | awk '/inet /{ gsub(/addr:/, ""); print $2 }'
else
echo 'ifconfig not installed'
fi
}
# Obtain a weather report
weather() {
if [ -n "$1" ]; then
curl "v1.wttr.in/$1"
else
curl 'v1.wttr.in'
fi
}