Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Test issues



On Jul 11,  4:29pm, Peter Stephenson wrote:
}
} +  myfd=
}    exec {myfd}>logfile
} -  print This is my logfile. >&$myfd
} -  print Examining contents of logfile...
} -  cat logfile
} +  if [[ -z $myfd ]]; then
} +    print "Ooops, failed to set myfd to a file descriptor." >&2

That's not going to help.  The problem is that if {mytfd} is not
recognized as a file descriptor, it's taken as a command, and the
"exec" causes the test script to replace itself with nothing (and
effectively exit).

The real solution is to put the entire thing in a subshell, I think.



Messages sorted by: Reverse Date, Date, Thread, Author