[Shell] Make localip a function

This commit is contained in:
Ivan Malison 2016-09-20 00:17:39 -07:00
parent 7b6353954a
commit 67f2f1a884
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 5 additions and 1 deletions

View File

@ -448,3 +448,8 @@ function in_git_directory {
function which_readlink { function which_readlink {
readlink -f "$(which $1)" readlink -f "$(which $1)"
} }
function localip {
command_exists ip && ip addr show
alias localip="ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'"
}

View File

@ -24,7 +24,6 @@ alias ls="command ls ${colorflag}"
# IP addresses # IP addresses
alias externalip="dig +short myip.opendns.com @resolver1.opendns.com" alias externalip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'"
alias whois="whois -h whois-servers.net" alias whois="whois -h whois-servers.net"