(I hope this wasn't already discussed, but from a quick search of
the mailing list archive I don't think so.)


    My RFC is the following: how about having a flag, say `-S`, that
would behave like `-s`, but which would instead have an argument
specifying the file descriptor number to read the script from (instead
of stdin).  Moreover, just like in `-c` case, the following extra
arguments are treaded like `$0`, and so forth.


    Now I know that there are countless ways to obtain this behaviour,
like for example:
    * using `mksh /dev/fd/5`, but which unfortunately puts `$0` as
`5`, and must be overridden in the script;
    * using `mksh -c '. /dev/fd/5' script-name`, which seems clumsy;
    * using `mksh -s` and playing with duplicating file descriptors;
`mksh` reads the script directly from `0`, which means that if I
replace `0` inside the script `mksh` will start reading there instead,
thus making impossible to have a proper stdin;

    However (most) all of them require the use of `/dev/fd` (or
`/proc/self/fd`), which wouldn't work in case these two file systems
aren't mounted, such as is the case in early booting where I intend to
use this feature.


    Ciprian.


    P.S.: If the developers are willing to accept a patch, I could
provide it, as I've studied the source code and doesn't seem too hard
to produce it myself.

Reply via email to