I wrote a test.c:
#include <unistd.h>
#include <stdio.h>
int main()
{
while(1)
{
sleep(1);
printf("====test====\r\n");
}
return 0;
}
then i compile it : gcc ./test.c -o ./test and the i wrote a shell script:
#!/bin/sh
./test &
and then i made this script to be executed automatically on system boot. then I login to the Linux system using secureCRT in SSH protocol. using "ps aux | grep test" i can see the test process running, but i just cannot see the test's output, some people told me because the test output to tty, and i am using pts. could anybody tell me the specific reason and how can i get the output? thanks in advance!
It doesn't output anything because it got no terminal attached.
If you want your output to be visible to every terminal connected to the system, use wall
./test | wall
(it will be very annoying)
I suggest you to redirect the output to a log file.