Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have one script file to take backup of certain files. It has following commands :
ping -c1 -i3 $IPADR >/dev/null 2>/dev/nullif test $? -eq 0; then
#cleanup old data files
rm -f /tmp/data.zip 2>/dev/nulli.e. it first pings $IPADR & checks if ping is successful by seeing result in $?. If ping is successful, then, it should result 0. The script has been written under that assumption. However, when i run this script on two different machines, on which ping is successful. But, one gives result $? = 0 & other one gives $?=1. What could be going wrong.If i ping IPADR, it is successful on both machines.

Couple of issues, which shell is the script written in and are you using the same flavor and version of UNIX on both systems?
Verify those first and then consider script changes, till then, the $?=1 value, if that is the whole script, just will not be deleting any files.

Hello Tom,
I appreciate your reply. The script is written in Bourne shell. On both systems, I have QNX4.25 OS loaded, with same application softwares running.The mentioned above is only some part of script. It does more things after checking value of "$?". I have only indicated the part which is crucial & giving problems.
Generally, "$? >> 8" represents exit value of subprocess. "$? & 127" indicates signal name, if any, the process died from and "$? & 128" represents core dump. Am i right?
Awaiting your comment.Thanks & Best Regards.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |