TunaAdmiral
MIS
Hi!
When I redirect the output of a command to a file, how do I capture an error condition of the command? It seems that the script can only capture an error in the redirection of the output of the command, not an error with the command itself.
As an example:
If the following command is entered WITHOUT a redirect to a file:
dsmadmc -id=admin -pass=tunafish q vol
ANS8002I Highest return code was 137.
We receive an error code 137. This is good.
However, if the same command has a redirect:
dsmadmc -id=admin -pass=tunafish q vol > tunafish.txt
We get a return code of 0. This is a damnable lie!
Does anyone know of a way to intercept the error code before the redirect occurs?
Any advice would be most welcome.
Thanks!
Mikeymac
When I redirect the output of a command to a file, how do I capture an error condition of the command? It seems that the script can only capture an error in the redirection of the output of the command, not an error with the command itself.
As an example:
If the following command is entered WITHOUT a redirect to a file:
dsmadmc -id=admin -pass=tunafish q vol
ANS8002I Highest return code was 137.
We receive an error code 137. This is good.
However, if the same command has a redirect:
dsmadmc -id=admin -pass=tunafish q vol > tunafish.txt
We get a return code of 0. This is a damnable lie!
Does anyone know of a way to intercept the error code before the redirect occurs?
Any advice would be most welcome.
Thanks!
Mikeymac