Absent Member.. Martin_gm Absent Member..
Absent Member..
515 views

HP OO Remote Command Execution SSH v2 SSH Shell and regular expressions

Hello world!

 

I would like to use OO's SSH client to perform management on some machines. However, the expect-instruction seems limited to some degraded regular expression. For instance

   

    expect a*

 

is a valid expression, but

 

    expect aa*

    expect a

    expect [a]

 

are not. Yet,

 

    expect (a)*

    expect [a]*

 

are valid expressions. The letter a is part of the output my SSH Shell sees, when I do the testing.

 

I recognise an invalid regular expression by a timeout after 20 seconds and a result containing "Script did not fully finish, had: 1 commands left" Depending on how many commands are left, one can tell which regex the parser did not like.

 

Ultimately I would like to replace a with a more complex regular expression. How can I make SSH Shell wait until it sees a? 

 

There is a similar question on this topic.

 

Cheers

 

Martin

Labels (1)
0 Likes
1 Reply
Absent Member.. Martin_gm Absent Member..
Absent Member..

Re: HP OO Remote Command Execution SSH v2 SSH Shell and regular expressions

It would seem that with the expect instruction of the SSH Shell operation the entire output must match the provided regex. Hence, the regex of

 

expect a

 

must be read as

 

^a$

 

matching only if the entire output is precisely 'a'. 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.