I will run the following script:
#!/bin/bash ./myprogram #get exit code exitvalue=$? #log exit code value to /var/log/messages logger -s \"exit code of my prog
I don't think you really need to (or want to) involve logger/syslog for this. Simply replace the last line of the script with:
logger
syslog
echo "Exit code of my program is $exitvalue" >> /some/file/that/you/can/write/to