Forum Discussion
On 12/27/2022 at 10:09 AM, Lewis Beard said:> [m /usr/bin/ls -1
This part is expected, since .before() returns everything from the last time the prompt was detected. This includes any commands you send. So, you'll almost always need to exclude the first line from any .before() result.
Did i understand right that "[m" is supposed to be part of your prompt? If so, I'd work on your prompt variable to make sure that it's recognized by expect as part of your prompt. That should clear things up. That said, i'm not sure if "[m" is coming across as two characters or some sort of escaped special character.
On 12/27/2022 at 10:09 AM, Lewis Beard said:Here is the code, my hope is that there is just something fundamental I can do, something simple, to NOT have the command and terminal stuff I'm sending be part of the results of .before().
The thing is that .before() grabs from the combined text stream built from both your input and also the various pipes provided by the host (which pipes is somehow configurable in your conn object). There may be a way of getting just the sdtout pipe from the host, but that's getting into depth of expect that I'm not familiar with. I've always just ignored the first line of the output knowing it contained my command.
Related Content
- 11 months ago
- 10 years ago