Hi, I need to set stdout to go to a String variable, has anyone got any ideas?
I'm not sure I grasp your question. You're trying to read from stdout??
I want to change stdout to instead of displaying on a monitor put it in a variable.
I think you mean this:
#!/bin/ksh
myDirectory="$(pwd)"
echo "This is my current directory->[${myDirectory}]"
Basically i have a fork and a execl i need to send the output of the execl instead of onto the screen, into a variable. I need to do this as the need to send it over a socket. I have writing the program in C and C++
Instead of execl use popen - it does just what you want.
man popen.
brilliant. Popen did just what i wanted. thanks!