Operating System - HP-UX
1832880 Members
2667 Online
110048 Solutions
New Discussion

Re: send GSP commands via script please help

 
SOLVED
Go to solution
jamesps
Regular Advisor

send GSP commands via script please help

I would like to script some commands normally sent via the GSP. To be able to get the server's console via GSP (read/write) you need to type ^Ecf. Since I need to send this via script, how do I echo this?

I am doing something like:
./gspcommands | telnet

My "gspcommands" script holds whatever I need to pass to the GSP and here it is where I need to put the ^Ecf in an "echo" as well.

Thanks,
james
6 REPLIES 6
Mel Burslan
Honored Contributor
Solution

Re: send GSP commands via script please help

using vi:

echo "[ctrl-v (release)][ctrl-E (release)][c][f]"

keep in mind that in my above notation, anything in a pair of [] s is one keystroke

But you have to be doing much more than a simple pipe, you need to use something like expect to read the prompts coming back from GSP otherwise, command timing will be way off and your command most probably will not work.

expect can be obtained from:
http://hpux.cs.utah.edu/

just search for expect with their built in search box

________________________________
UNIX because I majored in cryptology...
jamesps
Regular Advisor

Re: send GSP commands via script please help

Mel, thank you very much for your reply. That is a great help. You are right, the GSP response messages can cause some delay issues which can ruin the whole automated process. Is there a way to "read" the GSP answer in the script? Right now my script "sleeps" for the amount of time necessary and the entire process relies on that. That's the most "efficient" way I could come up so far :)
Can I send CRs (Enter's) using the same method?

Thanks again!
james
jamesps
Regular Advisor

Re: send GSP commands via script please help

Sorry I just saw the expect line at the end. I am downloading it right now. Thanks!
james
Mel Burslan
Honored Contributor

Re: send GSP commands via script please help

carriage return is ^M character. In a vi session ctrl-v followed by ctrl-m, iserts a character in a command sequence.
________________________________
UNIX because I majored in cryptology...
jamesps
Regular Advisor

Re: send GSP commands via script please help

I 'll start working on it right away. "expect" looks like the tool I needed to accomplish my task. Mel, thanks again for your replies!

james
jamesps
Regular Advisor

Re: send GSP commands via script please help

The solution has been provided by Mel above. Many thanks and a virtual 24-pack go to him :)

Thanks Mel!
james