vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| How can we find the exit code of the process that we run using the truss command. If i check the value of $? i get the exit code for the truss command and not for the process started using truss. I see that in HP-UX the -k option helps out in this case. When this option is used, tusc exits with the exit code of the process that was last traced. Please help. Thanks in Advance mmsganesh |
| |||
| Can some1 help on this please neoganesh wrote: > How can we find the exit code of the process that we run using the > truss command. If i check the value of $? i get the exit code for the > truss command and not for the process started using truss. > > I see that in HP-UX the -k option helps out in this case. When this > option is used, tusc exits with the exit code of the process that was > last traced. > > Please help. > > Thanks in Advance > mmsganesh |
| |||
| neoganesh wrote: > How can we find the exit code of the process that we run using the > truss command. If i check the value of $? i get the exit code for the > truss command and not for the process started using truss. > > I see that in HP-UX the -k option helps out in this case. When this > option is used, tusc exits with the exit code of the process that was > last traced. > > Please help. > > Thanks in Advance > mmsganesh |
| ||||
| neoganesh wrote: > How can we find the exit code of the process that we run using the > truss command. If i check the value of $? i get the exit code for the > truss command and not for the process started using truss. > > I see that in HP-UX the -k option helps out in this case. When this > option is used, tusc exits with the exit code of the process that was > last traced. > > Please help. > > Thanks in Advance > mmsganesh Curiously the exit status for truss does not appear to be defined (at http://publib.boulder.ibm.com/infoce...formation.htm). I suspect that it will always return 0 if it finds and executes the command. It looks like it returns 2 if no command is found or an invalid flag is specified. To capture the exit code of your program you will have to scan the output of truss, eg truss false 2>&1 | awk -F'[()]' '{status=$1} END {print status}' The awk script is there to expect a final line like "_exit(1)" and print the value within parentheses, ie "1". Note that this was done from a ksh prompt. If you don't want to redirect stderr to stdout you could use the -o flag instead and process that output file with the awk command after the truss command has completed, ie truss and awk on separate lines. Hope this helps. Jeffrey |