Subj : Running a command dynamically in a script To : comp.os.linux From : steve_roach Date : Fri Jul 09 2004 01:06 am Hi folks, I am trying to do a bit of shell scripting along these lines... .... # Get something from a file. The 'something' could be - ps > a_file # It is structured: # # 68<\ProcessInstanceId> # ps > /home/nwsupp/t003380/dev/omd/test.out<\CallText> #<\Data> call_text=`grep CallText $log | cut -c11- | cut -d'<\CallText>' -f1` # This grabs: ps > /home/nwsupp/t003380/dev/omd/test.out into call_text # As the 'something' is a command, execute it. $call_text # See how it did. status=$? # And tell us about it. echoStatus=$? .... There are a couple of problems with this: - 'ps' executes but does not redirect the output to a_file - Quite possibly because of this, when a_file can't be written to (maybe the target directory is owned by someone else), the status is 0 when it, in fact, failed. Of course, a possibility would be to shove the command into a file and execute that but I'd rather do it this way if possible. Any ideas? Cheers Steve .