Hi,
I trying to do a program that allows to connect to different UNIX servers (RedHat, AIX and Solaris) each of them with a different way to connect, and after the connection, it allows to send commands to the server.
I need to do it as shell conection because each connection have its own unique user, and the environment on each server is different, in one servers the shell is a Ksh, csh, bash or sh. Each of them have a different Environment variables, and I should maintain that environment to execute my commands.
Sometimes, I need to execute commands as my work user, and other times as a technical user, doing an impersonation.
My principal issue, is when a command request me for a keyboard entry, I don't know how to detect those keyboard interactive entries.
I use this program to connect to one server, execute some commands, something like this:
$ sudo su - tech
$ mkdir xxx
$ exit
$ mkdir yyy
$ gzip -9 man.tar
man.tar exists, do you want to overwrite?
Before you go to answer me, please take in account that the question could be "man.tar exists, do you want to overwrite?" or something like this "No se puede copiar, Desea continuar?", or different interactive questions from different shell scripts, like programs paths, or DB drives.
Well, the question is: Is there any way to detect into a shellstream object that the command is waiting for a keyboard entry from the user?
I trying to do a program that allows to connect to different UNIX servers (RedHat, AIX and Solaris) each of them with a different way to connect, and after the connection, it allows to send commands to the server.
I need to do it as shell conection because each connection have its own unique user, and the environment on each server is different, in one servers the shell is a Ksh, csh, bash or sh. Each of them have a different Environment variables, and I should maintain that environment to execute my commands.
Sometimes, I need to execute commands as my work user, and other times as a technical user, doing an impersonation.
My principal issue, is when a command request me for a keyboard entry, I don't know how to detect those keyboard interactive entries.
I use this program to connect to one server, execute some commands, something like this:
$ sudo su - tech
$ mkdir xxx
$ exit
$ mkdir yyy
$ gzip -9 man.tar
man.tar exists, do you want to overwrite?
Before you go to answer me, please take in account that the question could be "man.tar exists, do you want to overwrite?" or something like this "No se puede copiar, Desea continuar?", or different interactive questions from different shell scripts, like programs paths, or DB drives.
Well, the question is: Is there any way to detect into a shellstream object that the command is waiting for a keyboard entry from the user?