Telnet redis bash script

How can I extract the output from the 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 to achieve this goal in a bash script?

Thanks,

+4
source share
1 answer

try it

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

echo $RET

and I think using telnet session automation using bash scripts by post by fedorqui would be better

+7
source

All Articles