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

Re: Do file descriptors survive to subshell?



On Sep 12,  6:29pm, Sebastian Gniazdowski wrote:
}
} BTW., read -t -u seems to succeed as many times as there are lines in
} a file (file descriptor), that's rather unexpected, it rather should
} do some "read char, put char back" thing, or something not changing FD
} position in file I would say

?? That's not how "read" is defined.  It either reads a line if it can,
or it returns failure if it can't.  The -t option only changes what
"it can't" means, and the -u option only changes where it reads it.
You can change how "a line" is defined, but you can't define "a line"
as nothing.

You might suggest that -k 0 should test whether reading is possible and
return success without actually reading anything, but as currently
defined "read" returns nonzero only when bytes are consumed.



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