Hi all,
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); ssh.Connect(); tername = sessionInfo.m_host + "@"+ sessionInfo.m_user; shells = ssh.CreateShellStream(tername, 80, 24, 800, 600, 1024); //checking for promt shells.WriteLine(command); String outp = ""; Regex regex = new Regex(@"\[.*@.*\][\$|\#]"); //my promt is variablevar 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.