Operating System - HP-UX
1753802 Members
8225 Online
108805 Solutions
New Discussion юеВ

Re: Can anyone let me know what is the delimiter to pass '{' to unix from Rational Functional Tester

 
rhondapereira
Occasional Contributor

Can anyone let me know what is the delimiter to pass '{' to unix from Rational Functional Tester

Hi,

I am using Rational Functional Tester Script as a front end testing tool to display a unix command "awk '{ if(index($0, "rmk")> 0) {count++} if(count>1) { print $0} } ' " onto a unix terminal window. I accomplish this by using PuTTYwindow().inputKeys("awk '{ if(index($0, "rmk")> 0) {count++} if(count>1) { print $0} } ' ");
For some reason this does not work,RFT (uses Javascript) throws me errors. When I narrowed the problem down it looks like I am not able to find a suitable delimiter for the character '{' while passing it to unix.

Can anyone let me know what is the delimiter to pass '{' to unix from Rational Functional Tester ( or javascript)?

Thanks,
Rhonda
3 REPLIES 3
Arturo Galbiati
Esteemed Contributor

Re: Can anyone let me know what is the delimiter to pass '{' to unix from Rational Functional Tester

Hi Rhonda,
since I don't have PuTTY I cannot test my suggestion but usually \ escape the chars, so try it.
HTH,
Art
OldSchool
Honored Contributor

Re: Can anyone let me know what is the delimiter to pass '{' to unix from Rational Functional Tester

Rhonda

PuTTYwindow().inputKeys("awk '{ if(index($0, "rmk")> 0) {count++} if(count>1) { print $0} } ' ");

If this is the exact command I would think you're going to have problems with the double-qoutes around "rmk" as well.

Most languages require multiple quotes to signal the presence of a "real" qoute to be written, but I can't say for sure javascript or Rational Function Tester.

Something like:

PuTTYwindow().inputKeys("awk '{ if(index($0, """rmk""")> 0) {count++} if(count>1) { print $0} } ' ");

might work

rhondapereira
Occasional Contributor

Re: Can anyone let me know what is the delimiter to pass '{' to unix from Rational Functional Tester

Thank you for taking the time to reply ... ( Putty.exe is just a remote terminal client which can be downloaded for free).. I have already tried all the options mentioned by you....not sure why RFT does not seem to bypass special characters like {,(, " .... so I came up with a workaround which seemed to work perfectly....but there should be a better way of doing this.....
_135215230PuTTYwindow().inputKeys("awk '");
_135215230PuTTYwindow().inputChars("{");
_135215230PuTTYwindow().inputKeys(" if");
_135215230PuTTYwindow().inputChars("(");
_135215230PuTTYwindow().inputKeys("index");
_135215230PuTTYwindow().inputChars("(");
_135215230PuTTYwindow().inputKeys("$0, \"rmk\" ");
_135215230PuTTYwindow().inputChars(")");
_135215230PuTTYwindow().inputKeys("> 0");
_135215230PuTTYwindow().inputChars("){");
_135215230PuTTYwindow().inputKeys("count");
_135215230PuTTYwindow().inputChars("++}");
_135215230PuTTYwindow().inputKeys("if");
_135215230PuTTYwindow().inputChars("(");
_135215230PuTTYwindow().inputKeys("count>1");
_135215230PuTTYwindow().inputChars("){");
_135215230PuTTYwindow().inputKeys("print $0");
_135215230PuTTYwindow().inputChars("}}");
_135215230PuTTYwindow().inputKeys("' {ENTER}");