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
This commit is contained in:
Alexander Hess 2022-08-11 16:56:28 +02:00
commit a8f8caccc0
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
17 changed files with 665 additions and 621 deletions

View file

@ -0,0 +1,26 @@
# 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
}