I have this shell script and in case the sybase process is been killed how can identify whether the process was killed or not, as the error code always returns 0.
#!/bin/sh
isql -S SERVER -U user -P pass<<TOP
select * from tableName
go
TOP
echo $?
Cmd can make own signal handling and then make own exit codes. So you must search answer from isql documentation.
Also it's easy to test something like:
isql ...
echo "stat:$?"
echo ""
Run script in background, look cmd process id, sent some signals.
./script &
ps -f | grep isql
# look isql PID and test it:
kill -3 isqlPID
kill isqlPID
...
Ex. I tested in my own system what is value of exit status if my cmd is find.
Exit code tell the interrupt signal (exitcode - 256 = signal). Also kill -9.