in reply to Tracert or resolve machine name

How long does it lock up the terminal for? This script just runs traceroute and displays the output from a string. If no route is found it should display that and exit. Otherwise it's taking a while to find a route the host #####

EDIT:
You could add a -w $milliseconds and a -h 30 to the tracert in order to limit the amount of time taken to return ie:

perl -e "@trace=`tracert -w 200 -p 30 perlmonks.org`;foreach $i (@trac +e){print \"$i\n\";}"

Replies are listed 'Best First'.
Re^2: Tracert or resolve machine name
by ww (Archbishop) on May 19, 2009 at 14:31 UTC

    On another w32 system:

    perl -e "@trace=`tracert -w 200 -p 30 perlmonks.org`;foreach $i (@trac +e){print \"$i\n\";}" -p is not a valid command option. Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] targ +et_name Options: -d Do not resolve addresses to hostnames. -h maximum_hops Maximum number of hops to search for target. -j host-list Loose source route along host-list. -w timeout Wait timeout milliseconds for each reply.

    Remove the -p 30 (did you mean -h 30 as suggested by your text? If so, that appears to be the default and is thus unnecessary) and the output (omitting the first few hops) is as expected:

    Tracing route to perlmonks.org [66.39.54.27] over a maximum of 30 hops +: ... 9 59 ms 59 ms 59 ms 0.so-5-2-0.XL3.IAD8.ALTER.NET [152.63. +36.25] 10 70 ms 77 ms 73 ms pairnetworks-gw.customer.alter.net [63 +.65.185.2] 11 * * * Request timed out. 12 75 ms 71 ms 73 ms ads.perlmonks.org [66.39.54.27] Trace complete.

    which underscores the value of mr_mischief's suggestion.