bashrc & zshrc: replace myip function with alias using curl & add myip4 & myip6 aliases.

This commit is contained in:
Mika Suomalainen 2012-08-18 11:37:19 +03:00
parent eda4aa59d0
commit eece10f0bb
3 changed files with 12 additions and 12 deletions

11
bashrc
View File

@ -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}" ;}

View File

@ -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

12
zshrc
View File

@ -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}" ;}