Environment variables are inherited only from a parent process to a child process.
So invoking a child process and then trying to read it's environment after it has quit simply isn't going to work.
I suggest something like this for your script. Note that the output is sent to stdout, not some variable.
Code:
#!/bin/bash
scp zephost:/root/signal /home/oj/junk/signal
grep seg2 /home/oj/junk/signal | gawk '{print$2}'
In your C code, you do this
Code:
int main ( ) {
char buff[BUFSIZ]
FILE *fp = popen( "./getfile", "r" ); /* run a process, and read it's stdout */
while ( fgets( buff, BUFSIZ, fp ) != NULL ) {
/* buff contains successive lines of the output of the process you invoked */
}
pclose( fp );
return 0;