20 Jun 2012 18:33
piping input to executable reading from /dev/tty?
Dan B. <danb <at> kempt.net>
2012-06-20 16:33:19 GMT
2012-06-20 16:33:19 GMT
Is there any way to redirect /dev/tty similarly to how stdin can be redirected (e.g., like "echo ... | someexecutable")? I'm working with an executable (openssl in ocsp mode) that reads a password via /dev/tty (instead of stdin) because normally it wants to get that password from the user even if the user invoked the executable by running a script (and because it uses stdin for data input). (I can see the use of /dev/tty by using strace.) However, I'm trying to invoke that executable from a script and have it run non-interactively. (It's an example/test script that should be interactive and does not need to be secure.) Other OpenSSL subcommands like "openssl ca" and "openssl req" have command-line options for specifying passwords non-interactively. However, the "openssl ocsp" subcommand does not, so I'm trying to find some other way to suppress the interactive prompting for the password. VMS's equivalent of /dev/tty was its environment variable SYS$COMMAND. SYS$COMMAND by default continued to refer to the interactive terminal even when SYS$INPUT (VMS's equivalent to the stdin descriptor) was redirected. Therefore, scripts could read from SYS$COMMAND when they wanted to read something that normally came from the user even when standard input was redirected. However, a second script calling that first script could specifically set SYS$COMMAND if it wanted to non-interactively provide that input that the first script expected to normally come from the user. Does Cygwin (or Unix/Linux, for that matter) have any equivalent way(Continue reading)
RSS Feed