Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pipe data to redis

Tags:

redis

pipe

When I pipe the echo to redis client, I get an error.

[root@server ~]$ echo "abc43345" | redis-cli set my_passwd2
(error) ERR wrong number of arguments for 'set' command

But the following works as expected.

[root@server ~]$ redis-cli set my_passwd2 `echo "abc43345"`
OK

Is there any way to make the first example work?

like image 470
shantanuo Avatar asked Dec 22 '22 06:12

shantanuo


1 Answers

It can actually be achieved using "-x" flag

echo "abc43345" | redis-cli -x set my_passwd2

like image 173
seppo0010 Avatar answered Jan 10 '23 06:01

seppo0010