in reply to Re: Ping and Tracert
in thread Ping and Tracert

-c 3 doesn't work on Solaris. Any suggestions as to how I can write the script to be usable on both Solaris and Linux platforms?

Thanks.

qball~"I have node idea?!"

Replies are listed 'Best First'.
Re: Re: Re: Ping and Tracert
by tachyon (Chancellor) on Aug 31, 2001 at 22:32 UTC

    You get the OS name in $^O so all you need to do is (pseudocode)

    print "The OS is $^O"; if ( $^O =~ /Linux/ ) { &linux_ping; } elsif ( $^O =~ /Solaris/ ) { &sun_ping; } else { die "Get a real OS!\n"; }

    I don't know what $^O holds on Solaris so you will have to tweak the matches to suit.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Ok, I can ping Linux X number of times using -c, but Solaris? What's the param for that. I've been searching through the man pages and can't find it.

      Thanks.

      qball~"I have node idea?!"

        Sorry, can't help. You could always fall back on a loop &ping for 0..4

        cheers

        tachyon

        s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print