Shell script to diagnose the network

i have learnt a little bit of shell scripting but not alot. i want to write a script to diagnose the network using ping and another script to traceroute. how would i do this?

ping hostname
traceroute hostname

...though I suspect you're going to need to give a lot more detail on what you actually want.

u can also use tcpdump and netstat for monitoring

well i just want to write a shell script so that i can check the network using ping and traceroute

Do you just want a combined traceroute/ping command? Or is it supposed to actually do anything with the results?

i want them as 2 different programs and just to give message like network is online else network is offline

:confused: Why would you bother running traceroute if you didn't want to see its output? If ping can't get through, neither will traceroute, they're both ICMP...