bLiTzKrieg Contributor.
Contributor.
344 views

weird behavior of ssh shell operation v2

I am trying to run below unix command using ssh shell v2 operation.

 

send bpdbjobs -all_columns | grep "${Client server}" | grep "${PolicyDetails}"| grep -m1 "Daily_Incr" | sed "s/^.*write time://"

expect (.*\s*)*#

 [copied and pasted the above from “command” input of ssh shell operation]

while running the same command in debugger, new line characters are getting automatically inserted between “g” and “r” of grep command

refer fig1.png [or below screenshot]

fig1.PNG

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I had tried googling and reframed the command as below:

 

send bpdbjobs -all_columns | (grep "${Client server}" | grep "${PolicyDetails}"| grep -m1 "Daily_Incr" | sed "s/^.*write time://")

expect (.*\s*)*#

 

[i.e. included all the piped inputs in small braces]

 

And this time \n\r got inserted after pipe and grep is fine

 

o/p for debugger: (copied it as it is from step result inspector)

bpdbjobs -all_columns | (grep "omstfbtw01" | 

grep "osslab_windows_test"| grep -m1 "Daily_Incr" | sed "s/^.*write time://")

osslabnbuama01:/home/maintenance #

 

refer atached fig2.png or below screenshot

fig2.PNG

 

Just wanted to check did any one encountered this kind of strange issue previously or do you have any workaround for this?

0 Likes
2 Replies
bLiTzKrieg Contributor.
Contributor.

Re: weird behavior of ssh shell operation v2

Basically the issue is encountered while using multiple commands with pipes

0 Likes
bLiTzKrieg Contributor.
Contributor.

Re: weird behavior of ssh shell operation v2

Basically the issue is encountered while using multiple unix commands with variable substitution using pipes

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.