From eece10f0bb536432c19097dfa1f4b40338739163 Mon Sep 17 00:00:00 2001 From: Mika Suomalainen Date: Sat, 18 Aug 2012 11:37:19 +0300 Subject: [PATCH] bashrc & zshrc: replace myip function with alias using curl & add myip4 & myip6 aliases. --- bashrc | 11 +++++------ warnings | 1 + zshrc | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bashrc b/bashrc index 35495815..5d5b32b9 100644 --- a/bashrc +++ b/bashrc @@ -322,6 +322,11 @@ alias gpg-key-count="gpg --export -a|gpg --import" alias follow="tail -f " +#myip shows current IP. This was a function. +alias myip="curl http://cadoth.net/~mkaysi/IP.php" +alias myip4="curl -6 http://cadoth.net/~mkaysi/IP.php" +alias myip6="curl -6 http://cadoth.net/~mkaysi/IP.php" + # Allow custom aliases to be put in .aliases or .bash_aliases . # .aliases @@ -341,12 +346,6 @@ function geoip() { geoiplookup $1 } -# MYIP, copied from the ultimate bashrc http://goo.gl/qGK5j . I think that it requires lynx. -function myip() -{ -lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' -} - # Checks which package the command comes from. Copied from the ultimate bashrc http://goo.gl/qGK5j function cmdpkg() { PACKAGE=$(dpkg -S $(which $1) | cut -d':' -f1); echo "[${PACKAGE}]"; dpkg -s "${PACKAGE}" ;} diff --git a/warnings b/warnings index 7541fbab..2212672b 100644 --- a/warnings +++ b/warnings @@ -4,6 +4,7 @@ command -v \htop >/dev/null 2>&1 || { echo >&2 "WARNING: htop isn't installed! Y command -v \gpg2 >/dev/null 2>&1 || { echo >&2 "WARNING: gnupg2 isn't installed! You should install it, because it's used as gpg."; } command -v \lynx >/dev/null 2>&1 || { echo >&2 "WARNING: lynx isn't installed! You should install it, because it's used by many functions."; } command -v \gpg-agent >/dev/null 2>&1 || { echo >&2 "WARNING: gnupg-agent isn't installed. You should install it, because it's used by gpg.conf and xsessionrc in shell-things."; } +command -v \curl >/dev/null 2>&1 || { echo >&2 "WARNING: curl isn't installed! You should install it, because it's used by some aliases orfunctions."; } ## To disable warnings, add the following (UNCOMMENTED!) to ~/.custom diff --git a/zshrc b/zshrc index 9fe4109a..4c3a5d31 100644 --- a/zshrc +++ b/zshrc @@ -271,6 +271,12 @@ alias gpg-key-count="gpg --export -a|gpg --import" alias follow="tail -f " +#myip shows current IP. This was a function. +alias myip="curl http://cadoth.net/~mkaysi/IP.php" +alias myip4="curl -6 http://cadoth.net/~mkaysi/IP.php" +alias myip6="curl -6 http://cadoth.net/~mkaysi/IP.php" + + # .aliases if [ -f ~/.aliases ]; then source ~/.aliases @@ -288,12 +294,6 @@ function geoip() { geoiplookup $1 } -# MYIP, copied from the ultimate bashrc http://goo.gl/qGK5j . I think that it requires lynx. -function myip() -{ -lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' -} - # Checks which package the command comes from. Copied from the ultimate bashrc http://goo.gl/qGK5j function cmdpkg() { PACKAGE=$(dpkg -S $(which $1) | cut -d':' -f1); echo "[${PACKAGE}]"; dpkg -s "${PACKAGE}" ;}