The shell syntax for opening a file for writing and using its file descriptor is:exec 3>output.logWith bash and zsh you also can write:exec 13>output.logThus, later in your script you can redirect output like this:generate-partx >&3generate-partx >&13And to close them:exec 3>&-exec 13>&-The original ksh (tested 88 and 93) only seems to support file descriptor numbers 0 to 9 with that syntax.Sure, one could argue that 10 open file descriptors should be enough for everyone and/or that nobody is using ksh anymore.But sometimes it is not and you are.Thus, my question: How to open more than 10 file descriptors in a ksh script?
Opening more than 10 file descriptors with ksh
io redirection;ksh;file descriptors
In ksh, you can only use single digit for explicit file descriptor. With ksh93r and above, you can open more than 10 file descriptor by using the form:{var}>filename(bash and zsh copied this feature later).ksh will pick available file descriptor greater than or equal to 10, store file descriptor number in variable var:$ exec {var1}>/tmp/test1$ echo $var110$ exec {var2}>/tmp/test2$ echo $var211