S
S
samlowry2012-07-13 11:32:55
linux
samlowry, 2012-07-13 11:32:55

How to make an alias for whois to feed it urls, not domains?

I want to make it possible to give the whois command any URL, and not just a domain.
Came up with homies 2 options:

alias h="echo \$2 | awk -F/ '{print \$3}'|xargs /usr/bin/whois"

alias h='echo $2 | sed -E "s~^http://([^/]+)/~\1~"|xargs /usr/bin/whois'

Neither one nor the other does not work in the alias. How to adapt them for alias?
PS I'm reluctant to make a script: I'm used to transferring .aliasrc everywhere, and then copy some additional script.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rich, 2012-07-13
@rich

You can use functions .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question