On Sun, Nov 11, 2007 at 10:32:05PM +0100, ropers wrote:
> xterm -e "telnet ${1##telnet://}"
>
> When I click a telnet URL that does not specify a port, it works,
> xterm launches with telnet, which duly connects to the port.
>
> However, if I click a telnet URL that *does* specify a port, it does
> not work, xterm closes immediately. I've manually figured out that it
> throws the error message
>
> telnet: could not resolve mud.vhdev.com:1991/telnet: Name or service not known
>
> before closing.
>
> man telnet told me that telnet expects to be given the port number
> separated by a space, not divided by a colon.
>
> Currently, if I click on telnet://mud.vhdev.com:1991, telnet is called with
>
> telnet mud.vhdev.com:1991
>
> instead of
>
> telnet mud.vhdev.com 1991
>
> which would be correct.
I think maybe sed, not awk. Try:
xterm -e "telnet `echo ${1##telnet://}|sed -e 's/:/ /'`"
(which assumes $1 is properly formed).
--Barry