If you're using Bash or similar for the shell on the other end, how about doing:
my @result = $object->cmd('test -f foo.txt; echo $?')
Because in Bash $? holds the exit value of the last command, and test -f checks to see if the file given exists and is a regular file, $result[0] should contain either a 1 (file does not exist) or a 0 (file does exist). After you determine that, you can cat your file or display the appropriate error. | [reply] [d/l] [select] |
This is an interesting approach. I never actually thought
to have the shell do the work. Thanks for the input.
| [reply] |
have you tried just using getline? you should be able to do $line=$obj->getline(); after you issue your cat command and then eval what is returned. | [reply] [d/l] |
Thanks! I was not aware of that function. I will definately
have to look into it. I appreciate your help.
| [reply] |