Hiya all,
Simple question - yet no simple answer im afraid !
Is there a way to execute a shell script (child) which returns one line and get the current (parent) shell to execute the stdout from the child ???
example
child.sh
#!/bin/sh
echo "setenv DISPLAY xxx:03"
parent_prompt> ./child.sh
setenv DISPLAY xxx:03 #<--- parent would exe this line ????
many many thanks in advance for your feedback effort support and time in this .....
curleb
2
parents executing what their kids make...! what has the world come to...?
man xargs
And the answer is...
parent_prompt> eval `./child.sh` # That's backticks, not quotes!
-c
The parent process needs to invoke the child process using command substitution.
cat parent.ksh
#!/usr/bin/ksh
LINE=$(chld.sh)
and the child process should simply echo (return) the desired line.
cat child.ksh
#!/usr/bin/ksh
echo "setenv DISPLAY xxx:03"
Shamrock -- that will only set LINE to whatever;s come from the child. You'd need another line to execute the contents of $LINE
-c
Correct craigp84...eval would be the way to go as shown in your post.