i have created ShellStream, from SshClient. i m facing a problem while checking that output of the shell stream contains my user promt or not. Previously i was checking it using Regex class match method, but its not useful in case of
variable user promt. my user promt varies command by commands. here the code snippet.
when i open sh shell. its user promt
// creating shell stream.
ssh = new SshClient(connectionInfo);
tername = sessionInfo.m_host + "@" + sessionInfo.m_user;
shells = ssh.CreateShellStream(tername, 80, 24, 800, 600, 1024);
//checking for promt
String outp = "";
Regex regex = new Regex(@"\[.*@.*\][\$|\#]");
//my promt is variable
var match = regex.Match(outp);
while (shells.DataAvailable || !match.Success || outp=="")
outp += shells.Read();
match = regex.Match(outp);
sh-4.2$ like this.
kindly suggest any solution for it.