Skip to content

Instantly share code, notes, and snippets.

@chapeupreto
Last active August 22, 2016 16:27
Show Gist options
  • Save chapeupreto/ed38476764a16b1096433a90de1c8aab to your computer and use it in GitHub Desktop.
Save chapeupreto/ed38476764a16b1096433a90de1c8aab to your computer and use it in GitHub Desktop.
gethost
# this should be included in .bashrc or /etc/profile
# this function extracts the hostname of a url
function h()
{
[[ -z $1 ]] && echo "url deve ser fornecida" && return 1
echo "$1" | sed -E 's#(ftp|https?)://## ; s#:[0-9]*##g ; s#/.*##'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment