Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

telnet redis bash script

Tags:

bash

redis

telnet

How can I extract the output from a telnet command on a remote redis-server in a bash script.

I would do:

telnet remote-redis-ip 6379 
LRANGE mylist 0 -1

And save the result in a variable. How can I reach this goal under a bash script?

Thanks,

like image 409
Matt Avatar asked Oct 22 '13 10:10

Matt


1 Answers

try this

RET=`telnet remote-redis-ip 6379 << EOF
LRANGE mylist 0 -1
EOF`

echo $RET

and I think using expect automating telnet session using bash scripts post by fedorqui will be better

like image 136
Chair Avatar answered Sep 20 '22 01:09

Chair