|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can someone explain what these arguments mean?
Hi folks, I am betting this is a very simple thing, but I admit i don't know the proper terms to search it out correctly. I am self-learning at work. I've come on a section of code in a script: Code:
/usr/sbin/ping $dev 5 2 2>&1 | /usr/xpg4/bin/egrep -s "unknown host|no answer" What I can't figure out(or search out) is what the arguments "5 2 2>&1" are doing?? I thought it was setting 2 '5 byte messages' with a time to live of 2...something. But I can not find any data to support that or otherwise explain what's going on here. So thanks to anyone who can explain this. Marc |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Check
man ping on that system (I'm guessing it is Solaris) to get explanation of
5 2 .
2>&1 is a redirection technique, allowing to "merge" standard error messages into standard output stream.
|
| The Following User Says Thank You to bartus11 For This Useful Post: | ||
Marc G (12-17-2012) | ||
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
2>&1 directs standard error to standard output.
For the "$dev 2 5" arguments you will need to read the manual page ("man ping") for your system. My system does not support that usage. It would appear that "$dev" is the hostname, and "2 5" possibly the timeout and count. Check the man page. |
| The Following User Says Thank You to Scott For This Useful Post: | ||
Marc G (12-17-2012) | ||
|
#4
|
||||
|
||||
|
The ping command on AIX uses those two parameters. From the man page: Code:
5 PacketSize Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data. This parameter is included for compatibility with previous versions of the ping command. 2 Count Specifies the number of echo requests to be sent (and received). This parameter is included for compatibility with previous versions of the ping command. Example: ping server 5 2 PING server (xxx.xxx.xxx.xxx): 5 data bytes 13 bytes from xxx.xxx.xxx.xxx: icmp_seq=0 ttl=64 13 bytes from xxx.xxx.xxx.xxx: icmp_seq=1 ttl=64 --- server ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss |
| The Following User Says Thank You to in2nix4life For This Useful Post: | ||
Scott (12-17-2012) | ||
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Thank you all for giving me the answer here! I had not tried this on an AIX box. Only a virtual linux box and a Solaris server I have access too.
|
| Sponsored Links | ||
|
![]() |
| Tags |
| shell commands |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can someone explain this for me? | bashily | Shell Programming and Scripting | 2 | 03-18-2012 12:18 PM |
| grep with two arguments to arguments to surch for | Cybertron | Shell Programming and Scripting | 1 | 04-11-2011 04:46 AM |
| Can anyone please explain this?? | Diddy | Shell Programming and Scripting | 3 | 02-02-2011 03:01 AM |
| can any one explain this example | maxim42 | Shell Programming and Scripting | 4 | 05-27-2009 01:43 PM |
| if [ $? -eq 0 ] .. can someone explain this? | ranjita.c | Shell Programming and Scripting | 5 | 10-03-2006 07:50 PM |
|
|