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 you can use cat - witch echoes your output then >> [file] witch prints the output to [file] inset of terminal so the command would be
cat -
>> [file]
[file]
cat - >> [file]
the down side is you have to use ctrl+C or ctrl+Z to exit logger is better for online code
logger