I am trying to write a script which calls the following command
[root@xxxxx imtadmin]# admin tower
-------------------------------------------------------------------
GMS: address=xxxxx-42450, cluster=CLRTY-SA, physical address=xxxxx:45155
-------------------------------------------------------------------
NSA Tower Shell
Usage:
history Show admin shell command history.
!<command prefix> Execute a command maching the given prefix from the command history.
refresh Wake up monitor thread, to update clients.
autodiscovery <on|off> Turn autodiscovery on or off.
add <host(s)> Add given host(s) by address.
remove <host(s)> Remove given host(s) by address.
list clients Print listing of clients.
list services Print listing of client services.
select <address|index> Select a specific client host by address.
connect <address> [port] Connect to a given Select a specific
client host by address.
trace Send trace message on multicast channel.
trace <on|off> Turn trace listening on or off.
password <password> Change password for this session only.
reset password Reset password to local machine value.
group <group> Change channel group for this session only.
(such as CLRTY for listening to PPM
broadcasts.)
reset group Reset group to local machine value.
list group List group members.
exit|quit Exit the tower.
? Print this message.
> list clients **TERMINAL INPUT***
Discovered Clients:
--------------------------
1) xxxxx.ec2.internal:9091 [xxxxx-20212]
--------------------------
> refresh **TERMINAL INPUT***
> list clients **TERMINAL INPUT***
Discovered Clients:
--------------------------
1) xxxxxx.ec2.internal:9091 [xxxxx-59053]
2) yyyyy.ec2.internal:9091 [yyyyy-20212]
3) zzzzzz.ec2.internal:9091 [zzzzz]
--------------------------
>
My Script:
#!/usr/bin/expect
spawn /opt/clarity/bin/admin tower
set timeout -1
expect -re "^>{1}"
send "list clients"
My script does call the command admin tower and stops at the prompt > but it doesn't accept input provided by script or input I provide from the terminal (my goal is to provide input from the script).
This should work :
send "list clients\n"
expect eof